mirror of
https://github.com/zhigang1992/rmq.git
synced 2026-04-30 13:42:38 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user