Skip to content

Commit 65f4176

Browse files
committed
Checkboxradio: Fix error tests with jQuery 1.7.0
1 parent a640fae commit 65f4176

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

tests/unit/checkboxradio/core.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,38 +72,44 @@ test( "Checkbox creation requires a label, and finds it in all cases", function(
7272
test( "Calling checkboxradio on an unsupported element throws an error", function( assert ) {
7373
expect( 2 );
7474

75-
var error = new Error(
76-
"Can't create checkboxradio on element.nodeName=div and element.type=undefined"
77-
);
75+
var errorMessage =
76+
"Can't create checkboxradio on element.nodeName=div and element.type=undefined";
77+
var error = new Error( errorMessage );
7878
assert.raises(
7979
function() {
8080
$( "<div>" ).checkboxradio();
8181
},
82-
error,
82+
83+
// Support: jQuery 1.7.0 only
84+
$.fn.jquery === "1.7" ? errorMessage : error,
8385
"Proper error thrown"
8486
);
8587

86-
error = new Error(
87-
"Can't create checkboxradio on element.nodeName=input and element.type=button"
88-
);
88+
errorMessage = "Can't create checkboxradio on element.nodeName=input and element.type=button";
89+
error = new Error( errorMessage );
8990
assert.raises(
9091
function() {
9192
$( "<input type='button'>" ).checkboxradio();
9293
},
93-
error,
94+
95+
// Support: jQuery 1.7.0 only
96+
$.fn.jquery === "1.7" ? errorMessage : error,
9497
"Proper error thrown"
9598
);
9699
} );
97100

98101
test( "Calling checkboxradio on an input with no label throws an error", function( assert ) {
99102
expect( 1 );
100103

101-
var error = new Error( "No label found for checkboxradio widget" );
104+
var errorMessage = "No label found for checkboxradio widget";
105+
var error = new Error( errorMessage );
102106
assert.raises(
103107
function() {
104108
$( "<input type='checkbox'>" ).checkboxradio();
105109
},
106-
error,
110+
111+
// Support: jQuery 1.7.0 only
112+
$.fn.jquery === "1.7" ? errorMessage : error,
107113
"Proper error thrown"
108114
);
109115
} );

0 commit comments

Comments
 (0)