From ab0f1f189dbcf7c6c16a59cd6a358bc6c22fa0b0 Mon Sep 17 00:00:00 2001 From: Cameron McCord Date: Tue, 5 May 2015 18:42:08 -0600 Subject: [PATCH] added test to check that color doesn't change automatically --- ValidatorTests/ValidatorTests.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ValidatorTests/ValidatorTests.swift b/ValidatorTests/ValidatorTests.swift index 36f9824..acce060 100644 --- a/ValidatorTests/ValidatorTests.swift +++ b/ValidatorTests/ValidatorTests.swift @@ -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") + } + } }