Skip to content

Commit ab0f1f1

Browse files
added test to check that color doesn't change automatically
1 parent 6c93e83 commit ab0f1f1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ValidatorTests/ValidatorTests.swift

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

4545
let ERROR_LABEL = UILabel()
4646

47-
let GREEN_COLOR = UIColor.greenColor()
48-
4947
override func setUp() {
5048
super.setUp()
5149
// Put setup code here. This method is called before the invocation of each test method in the class.
@@ -250,4 +248,13 @@ class ValidatorTests: XCTestCase {
250248
XCTAssert(CGColorEqualToColor(self.REGISTER_TXT_FIELD.layer.borderColor, UIColor.redColor().CGColor), "Color should be what it was set as")
251249
}
252250
}
251+
252+
func testTextFieldBorderColorNotSet() {
253+
REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()])
254+
REGISTER_TXT_FIELD.text = INVALID_EMAIL
255+
REGISTER_VALIDATOR.validate { (errors) -> Void in
256+
XCTAssert(errors.count == 1, "Should come back with errors")
257+
XCTAssert(!CGColorEqualToColor(self.REGISTER_TXT_FIELD.layer.borderColor, UIColor.redColor().CGColor), "Color shouldn't get set at all")
258+
}
259+
}
253260
}

0 commit comments

Comments
 (0)