From ae64d629515336df41d6265ee013b26f7c5bdf1b Mon Sep 17 00:00:00 2001 From: Cameron McCord Date: Tue, 5 May 2015 18:35:23 -0600 Subject: [PATCH] removed color feature --- Validator/Validator.swift | 3 +-- Validator/ViewController.swift | 1 - ValidatorTests/ValidatorTests.swift | 11 ----------- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Validator/Validator.swift b/Validator/Validator.swift index 73c09c0..a92d19a 100644 --- a/Validator/Validator.swift +++ b/Validator/Validator.swift @@ -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 } diff --git a/Validator/ViewController.swift b/Validator/ViewController.swift index a31f485..76974bf 100644 --- a/Validator/ViewController.swift +++ b/Validator/ViewController.swift @@ -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) { diff --git a/ValidatorTests/ValidatorTests.swift b/ValidatorTests/ValidatorTests.swift index 020564f..656e602 100644 --- a/ValidatorTests/ValidatorTests.swift +++ b/ValidatorTests/ValidatorTests.swift @@ -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") - } - } }