This repository was archived by the owner on Mar 12, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -533,6 +533,10 @@ $(function () {
533
533
+ '<input type="text" id="bar" data-foo="foo" value="bar">'
534
534
+ '<div class="help-block with-errors"></div>'
535
535
+ '</div>'
536
+ + '<div class="form-group">'
537
+ + '<input type="text" id="baz" data-foo value="baz">'
538
+ + '<div class="help-block with-errors"></div>'
539
+ + '</div>'
536
540
+ '<button type="submit">Submit</button>'
537
541
+ '</form>'
538
542
@@ -552,6 +556,7 @@ $(function () {
552
556
assert . ok ( $ ( '#foo' ) . data ( 'bs.validator.errors' ) . length === 0 , 'foo input is valid' )
553
557
assert . ok ( $ ( '#bar' ) . data ( 'bs.validator.errors' ) . length === 1 , 'bar input is invalid' )
554
558
assert . ok ( $ ( '#bar' ) . data ( 'bs.validator.errors' ) [ 0 ] === 'not equal to foo' , 'bar error is custom error' )
559
+ assert . ok ( $ ( '#baz' ) . data ( 'bs.validator.errors' ) . length === 1 , 'baz ran validator even though data-foo has no attr value' )
555
560
} )
556
561
557
562
QUnit . test ( 'should update set of fields' , function ( assert ) {
Original file line number Diff line number Diff line change 204
204
$ . each ( this . validators , $ . proxy ( function ( key , validator ) {
205
205
var error = null
206
206
if ( ( getValue ( $el ) || $el . attr ( 'required' ) ) &&
207
- ( $el . attr ( 'data-' + key ) || key == 'native' ) &&
207
+ ( $el . attr ( 'data-' + key ) !== undefined || key == 'native' ) &&
208
208
( error = validator . call ( this , $el ) ) ) {
209
209
error = getErrorMessage ( key ) || error
210
210
! ~ errors . indexOf ( error ) && errors . push ( error )
You can’t perform that action at this time.
0 commit comments