Skip to content

Commit 6c93e83

Browse files
Added test for testing uitextfield border color
1 parent c6f82a0 commit 6c93e83

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

ValidatorTests/ValidatorTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class ValidatorTests: XCTestCase {
4444

4545
let ERROR_LABEL = UILabel()
4646

47+
let GREEN_COLOR = UIColor.greenColor()
48+
4749
override func setUp() {
4850
super.setUp()
4951
// Put setup code here. This method is called before the invocation of each test method in the class.
@@ -238,4 +240,14 @@ class ValidatorTests: XCTestCase {
238240
}
239241
}
240242
}
243+
244+
func testTextFieldBorderColorSet() {
245+
REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()])
246+
REGISTER_TXT_FIELD.text = INVALID_EMAIL
247+
REGISTER_VALIDATOR.shouldMarkTextFieldsInError = true
248+
REGISTER_VALIDATOR.validate { (errors) -> Void in
249+
XCTAssert(errors.count == 1, "Should come back with errors")
250+
XCTAssert(CGColorEqualToColor(self.REGISTER_TXT_FIELD.layer.borderColor, UIColor.redColor().CGColor), "Color should be what it was set as")
251+
}
252+
}
241253
}

0 commit comments

Comments
 (0)