removed color feature

This commit is contained in:
Cameron McCord 2015-05-05 18:35:23 -06:00
parent 4c7462e6a5
commit ae64d62951
3 changed files with 1 additions and 14 deletions

View File

@ -19,7 +19,6 @@ public class Validator {
public var errors:[UITextField:ValidationError] = [:]
public var validations:[UITextField:ValidationRule] = [:]
public var shouldMarkTextFieldsInError:Bool = false
public var textFieldErrorColor:UIColor = UIColor.redColor()
public init(){}
@ -39,7 +38,7 @@ public class Validator {
}
private func markTextFieldAsInError(field:UITextField) {
field.layer.borderColor = self.textFieldErrorColor.CGColor
field.layer.borderColor = UIColor.redColor().CGColor
field.layer.borderWidth = 1.0
}

View File

@ -38,7 +38,6 @@ class ViewController: UIViewController , ValidationDelegate, UITextFieldDelegate
validator.registerField(emailConfirmTextField, errorLabel: emailConfirmErrorLabel, rules: [RequiredRule(), ConfirmationRule(confirmField: emailTextField)])
validator.registerField(phoneNumberTextField, errorLabel: phoneNumberErrorLabel, rules: [RequiredRule(), MinLengthRule(length: 9)])
validator.registerField(zipcodeTextField, errorLabel: zipcodeErrorLabel, rules: [RequiredRule(), ZipCodeRule()])
}
@IBAction func submitTapped(sender: AnyObject) {

View File

@ -240,15 +240,4 @@ class ValidatorTests: XCTestCase {
}
}
}
func testTextFieldBorderColorSet() {
REGISTER_VALIDATOR.registerField(REGISTER_TXT_FIELD, errorLabel: ERROR_LABEL, rules: [EmailRule()])
REGISTER_TXT_FIELD.text = INVALID_EMAIL
REGISTER_VALIDATOR.textFieldErrorColor = GREEN_COLOR
REGISTER_VALIDATOR.shouldMarkTextFieldsInError = true
REGISTER_VALIDATOR.validate { (errors) -> Void in
XCTAssert(errors.count == 1, "Should come back with errors")
XCTAssert(CGColorEqualToColor(self.REGISTER_TXT_FIELD.layer.borderColor, self.GREEN_COLOR.CGColor), "Color should be what it was set as")
}
}
}