Adds validations to selectors

* Adds the ability to:
    * rmq.append(selector).validates(:email).data('x')
    * rmq.all.valid?
    * rmq(some_selector).valid?
This commit is contained in:
David Larrabee
2014-07-11 00:09:51 -04:00
parent 70972397c4
commit 208af97d7a
3 changed files with 46 additions and 5 deletions

View File

@@ -90,6 +90,18 @@ describe 'validation' do
@rmq.validation.valid?('taco loco', :digits).should == false
end
end
it 'can check validations based on selections' do
vc = UIViewController.alloc.init
vc.rmq.append(UITextField).validates(:digits).data('taco loco').tag(:one)
vc.rmq.append(UITextField).validates(:digits).data('123455').tag(:two)
vc.rmq.append(UITextField).validates(:digits).data('1234').tag(:three)
vc.rmq.all.valid?.should == false
vc.rmq(:one).valid?.should == false
vc.rmq(:one, :two).valid?.should == false
vc.rmq(:three, :two).valid?.should == true
end
end
end