added test to check that color doesn't change automatically

This commit is contained in:
Cameron McCord 2015-05-05 18:42:08 -06:00
parent 6c93e83a2d
commit ab0f1f189d
1 changed files with 9 additions and 2 deletions

View File

@ -44,8 +44,6 @@ class ValidatorTests: XCTestCase {
let ERROR_LABEL = UILabel()
let GREEN_COLOR = UIColor.greenColor()
override func setUp() {
super.setUp()
// 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 {
XCTAssert(CGColorEqualToColor(self.REGISTER_TXT_FIELD.layer.borderColor, UIColor.redColor().CGColor), "Color should be what it was set as")
}
}
func testTextFieldBorderColorNotSet() {
REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()])
REGISTER_TXT_FIELD.text = INVALID_EMAIL
REGISTER_VALIDATOR.validate { (errors) -> Void in
XCTAssert(errors.count == 1, "Should come back with errors")
XCTAssert(!CGColorEqualToColor(self.REGISTER_TXT_FIELD.layer.borderColor, UIColor.redColor().CGColor), "Color shouldn't get set at all")
}
}
}