removed color feature
This commit is contained in:
parent
4c7462e6a5
commit
ae64d62951
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue