Skip to content

Commit 5ae668f

Browse files
committed
Tests: Enable QUnit.config.requireExpects.
1 parent 9b6c1c5 commit 5ae668f

23 files changed

+133
-2
lines changed

tests/unit/button/button_core.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
module("button: core");
99

1010
test("checkbox", function() {
11+
expect( 4 );
1112
var input = $("#check"),
1213
label = $("label[for=check]");
1314
ok( input.is(":visible") );
@@ -18,6 +19,7 @@ test("checkbox", function() {
1819
});
1920

2021
test("radios", function() {
22+
expect( 4 );
2123
var inputs = $("#radio0 input"),
2224
labels = $("#radio0 label");
2325
ok( inputs.is(":visible") );
@@ -34,6 +36,7 @@ function assert(noForm, form1, form2) {
3436
}
3537

3638
test("radio groups", function() {
39+
expect( 12 );
3740
$("input[type=radio]").button();
3841
assert(":eq(0)", ":eq(1)", ":eq(2)");
3942

@@ -51,13 +54,15 @@ test("radio groups", function() {
5154
});
5255

5356
test("input type submit, don't create child elements", function() {
57+
expect( 2 );
5458
var input = $("#submit");
5559
deepEqual( input.children().length, 0 );
5660
input.button();
5761
deepEqual( input.children().length, 0 );
5862
});
5963

6064
test("buttonset", function() {
65+
expect( 6 );
6166
var set = $("#radio1").buttonset();
6267
ok( set.is(".ui-buttonset") );
6368
deepEqual( set.children(".ui-button").length, 3 );
@@ -68,6 +73,7 @@ test("buttonset", function() {
6873
});
6974

7075
test("buttonset (rtl)", function() {
76+
expect( 6 );
7177
var set,
7278
parent = $("#radio1").parent();
7379
// Set to rtl

tests/unit/button/button_options.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module("button: options");
77

88
test("disabled, explicit value", function() {
9+
expect( 4 );
910
$("#radio01").button({ disabled: false });
1011
deepEqual(false, $("#radio01").button("option", "disabled"),
1112
"disabled option set to false");
@@ -18,6 +19,7 @@ test("disabled, explicit value", function() {
1819
});
1920

2021
test("disabled, null", function() {
22+
expect( 4 );
2123
$("#radio01").button({ disabled: null });
2224
deepEqual(false, $("#radio01").button("option", "disabled"),
2325
"disabled option set to false");
@@ -30,6 +32,7 @@ test("disabled, null", function() {
3032
});
3133

3234
test("text false without icon", function() {
35+
expect( 1 );
3336
$("#button").button({
3437
text: false
3538
});
@@ -39,6 +42,7 @@ test("text false without icon", function() {
3942
});
4043

4144
test("text false with icon", function() {
45+
expect( 1 );
4246
$("#button").button({
4347
text: false,
4448
icons: {
@@ -51,6 +55,7 @@ test("text false with icon", function() {
5155
});
5256

5357
test("label, default", function() {
58+
expect( 2 );
5459
$("#button").button();
5560
deepEqual( $("#button").text(), "Label" );
5661
deepEqual( $( "#button").button( "option", "label" ), "Label" );
@@ -59,6 +64,7 @@ test("label, default", function() {
5964
});
6065

6166
test("label", function() {
67+
expect( 2 );
6268
$("#button").button({
6369
label: "xxx"
6470
});
@@ -69,11 +75,13 @@ test("label", function() {
6975
});
7076

7177
test("label default with input type submit", function() {
78+
expect( 2 );
7279
deepEqual( $("#submit").button().val(), "Label" );
7380
deepEqual( $("#submit").button( "option", "label" ), "Label" );
7481
});
7582

7683
test("label with input type submit", function() {
84+
expect( 2 );
7785
var label = $("#submit").button({
7886
label: "xxx"
7987
}).val();
@@ -82,6 +90,7 @@ test("label with input type submit", function() {
8290
});
8391

8492
test("icons", function() {
93+
expect( 1 );
8594
$("#button").button({
8695
text: false,
8796
icons: {

tests/unit/button/button_tickets.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
module( "button: tickets" );
77

88
test( "#5946 - buttonset should ignore buttons that are not :visible", function() {
9+
expect( 2 );
910
$( "#radio01" ).next().andSelf().hide();
1011
var set = $( "#radio0" ).buttonset({ items: "input[type=radio]:visible" });
1112
ok( set.find( "label:eq(0)" ).is( ":not(.ui-button):not(.ui-corner-left)" ) );
1213
ok( set.find( "label:eq(1)" ).is( ".ui-button.ui-corner-left" ) );
1314
});
1415

1516
test( "#6262 - buttonset not applying ui-corner to invisible elements", function() {
17+
expect( 3 );
1618
$( "#radio0" ).hide();
1719
var set = $( "#radio0" ).buttonset();
1820
ok( set.find( "label:eq(0)" ).is( ".ui-button.ui-corner-left" ) );
@@ -21,6 +23,7 @@ test( "#6262 - buttonset not applying ui-corner to invisible elements", function
2123
});
2224

2325
test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard Navigation", function() {
26+
expect( 2 );
2427
var check = $( "#check" ).button(),
2528
label = $( "label[for='check']" );
2629
ok( !label.is( ".ui-state-focus" ) );
@@ -29,6 +32,7 @@ test( "#6711 Checkbox/Radiobutton do not Show Focused State when using Keyboard
2932
});
3033

3134
test( "#7092 - button creation that requires a matching label does not find label in all cases", function() {
35+
expect( 5 );
3236
var group = $( "<span><label for='t7092a'></label><input type='checkbox' id='t7092a'></span>" );
3337
group.find( "input[type=checkbox]" ).button();
3438
ok( group.find( "label" ).is( ".ui-button" ) );
@@ -51,6 +55,7 @@ test( "#7092 - button creation that requires a matching label does not find labe
5155
});
5256

5357
test( "#7534 - Button label selector works for ids with \":\"", function() {
58+
expect( 1 );
5459
var group = $( "<span><input type='checkbox' id='check:7534'><label for='check:7534'>Label</label></span>" );
5560
group.find( "input" ).button();
5661
ok( group.find( "label" ).is( ".ui-button" ), "Found an id with a :" );

tests/unit/core/core.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ asyncTest( "focus", function() {
2828
});
2929

3030
test( "zIndex", function() {
31+
expect( 7 );
3132
var el = $( "#zIndexAutoWithParent" ),
3233
parent = el.parent();
3334
equal( el.zIndex(), 100, "zIndex traverses up to find value" );
@@ -46,6 +47,7 @@ test( "zIndex", function() {
4647
});
4748

4849
test( "innerWidth - getter", function() {
50+
expect( 2 );
4951
var el = $( "#dimensions" );
5052

5153
equal( el.innerWidth(), 122, "getter passthru" );
@@ -54,6 +56,7 @@ test( "innerWidth - getter", function() {
5456
});
5557

5658
test( "innerWidth - setter", function() {
59+
expect( 2 );
5760
var el = $( "#dimensions" );
5861

5962
el.innerWidth( 120 );
@@ -64,6 +67,7 @@ test( "innerWidth - setter", function() {
6467
});
6568

6669
test( "innerHeight - getter", function() {
70+
expect( 2 );
6771
var el = $( "#dimensions" );
6872

6973
equal( el.innerHeight(), 70, "getter passthru" );
@@ -72,6 +76,7 @@ test( "innerHeight - getter", function() {
7276
});
7377

7478
test( "innerHeight - setter", function() {
79+
expect( 2 );
7580
var el = $( "#dimensions" );
7681

7782
el.innerHeight( 60 );
@@ -82,6 +87,7 @@ test( "innerHeight - setter", function() {
8287
});
8388

8489
test( "outerWidth - getter", function() {
90+
expect( 2 );
8591
var el = $( "#dimensions" );
8692

8793
equal( el.outerWidth(), 140, "getter passthru" );
@@ -90,6 +96,7 @@ test( "outerWidth - getter", function() {
9096
});
9197

9298
test( "outerWidth - setter", function() {
99+
expect( 2 );
93100
var el = $( "#dimensions" );
94101

95102
el.outerWidth( 130 );
@@ -100,6 +107,7 @@ test( "outerWidth - setter", function() {
100107
});
101108

102109
test( "outerWidth(true) - getter", function() {
110+
expect( 2 );
103111
var el = $( "#dimensions" );
104112

105113
equal( el.outerWidth(true), 154, "getter passthru w/ margin" );
@@ -108,6 +116,7 @@ test( "outerWidth(true) - getter", function() {
108116
});
109117

110118
test( "outerWidth(true) - setter", function() {
119+
expect( 2 );
111120
var el = $( "#dimensions" );
112121

113122
el.outerWidth( 130, true );
@@ -118,6 +127,7 @@ test( "outerWidth(true) - setter", function() {
118127
});
119128

120129
test( "outerHeight - getter", function() {
130+
expect( 2 );
121131
var el = $( "#dimensions" );
122132

123133
equal( el.outerHeight(), 86, "getter passthru" );
@@ -126,6 +136,7 @@ test( "outerHeight - getter", function() {
126136
});
127137

128138
test( "outerHeight - setter", function() {
139+
expect( 2 );
129140
var el = $( "#dimensions" );
130141

131142
el.outerHeight( 80 );
@@ -136,6 +147,7 @@ test( "outerHeight - setter", function() {
136147
});
137148

138149
test( "outerHeight(true) - getter", function() {
150+
expect( 2 );
139151
var el = $( "#dimensions" );
140152

141153
equal( el.outerHeight(true), 98, "getter passthru w/ margin" );
@@ -144,6 +156,7 @@ test( "outerHeight(true) - getter", function() {
144156
});
145157

146158
test( "outerHeight(true) - setter", function() {
159+
expect( 2 );
147160
var el = $( "#dimensions" );
148161

149162
el.outerHeight( 90, true );
@@ -154,6 +167,7 @@ test( "outerHeight(true) - setter", function() {
154167
});
155168

156169
test( "uniqueId / removeUniqueId", function() {
170+
expect( 3 );
157171
var el = $( "img" ).eq( 0 );
158172

159173
// support: jQuery <1.6.2

tests/unit/core/selector.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ test("focusable - not natively focusable with various tabindex", function() {
150150
});
151151

152152
test("focusable - area elements", function() {
153+
expect( 3 );
154+
153155
isFocusable('#areaCoordsHref', 'coords and href');
154156
isFocusable('#areaNoCoordsHref', 'href but no coords');
155157
isNotFocusable('#areaNoImg', 'not associated with an image');
@@ -227,6 +229,8 @@ test("tabbable - not natively tabbable with various tabindex", function() {
227229
});
228230

229231
test("tabbable - area elements", function() {
232+
expect( 3 );
233+
230234
isTabbable('#areaCoordsHref', 'coords and href');
231235
isTabbable('#areaNoCoordsHref', 'href but no coords');
232236
isNotTabbable('#areaNoImg', 'not associated with an image');

tests/unit/datepicker/datepicker_core.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,19 @@ var PROP_NAME = 'datepicker';
4343
module("datepicker: core");
4444

4545
test( "widget method - empty collection", function() {
46+
expect( 1 );
4647
$( "#nonExist" ).datepicker(); // should create nothing
4748
ok( !$( "#ui-datepicker-div" ).length, "Non init on empty collection" );
4849
});
4950

5051
test("widget method", function() {
52+
expect( 1 );
5153
var actual = $("#inp").datepicker().datepicker("widget")[0];
5254
deepEqual($("body > #ui-datepicker-div:last-child")[0], actual);
5355
});
5456

5557
test('baseStructure', function() {
58+
expect( 59 );
5659
var header, title, table, thead, week, panel, inl, child,
5760
inp = init('#inp').focus(),
5861
dp = $('#ui-datepicker-div'),
@@ -176,6 +179,7 @@ test('baseStructure', function() {
176179
});
177180

178181
test('customStructure', function() {
182+
expect( 20 );
179183
var iframe, header, panel, title, thead,
180184
dp = $('#ui-datepicker-div'),
181185
// Check right-to-left localisation
@@ -233,6 +237,7 @@ test('customStructure', function() {
233237
});
234238

235239
test('keystrokes', function() {
240+
expect( 26 );
236241
var inp = init('#inp'),
237242
date = new Date();
238243
inp.val('').datepicker('show').
@@ -367,6 +372,7 @@ test('keystrokes', function() {
367372
});
368373

369374
test('mouse', function() {
375+
expect( 15 );
370376
var inl,
371377
inp = init('#inp'),
372378
dp = $('#ui-datepicker-div'),

tests/unit/datepicker/datepicker_events.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function callback2(year, month, inst) {
2222
}
2323

2424
test('events', function() {
25+
expect( 26 );
2526
var dateStr, newMonthYear, inp2,
2627
inp = init('#inp', {onSelect: callback}),
2728
date = new Date();

tests/unit/datepicker/datepicker_methods.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
module("datepicker: methods");
77

88
test('destroy', function() {
9+
expect( 33 );
910
var inl,
1011
inp = init('#inp');
1112
ok(inp.is('.hasDatepicker'), 'Default - marker class set');
@@ -63,6 +64,7 @@ test('destroy', function() {
6364
});
6465

6566
test('enableDisable', function() {
67+
expect( 33 );
6668
var inl, dp,
6769
inp = init('#inp');
6870
ok(!inp.datepicker('isDisabled'), 'Enable/disable - initially marked as enabled');

0 commit comments

Comments
 (0)