Skip to content

Commit 890510c

Browse files
committed
Calendar tests: Use assert.expect instead of global expect
1 parent 96b5a76 commit 890510c

File tree

8 files changed

+74
-74
lines changed

8 files changed

+74
-74
lines changed

tests/unit/calendar/core.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ module( "calendar: core", {
1414
}
1515
} );
1616

17-
test( "base structure", function() {
18-
expect( 28 );
17+
test( "base structure", function( assert ) {
18+
assert.expect( 28 );
1919

2020
var that = this,
2121
buttons, header, title, table, thead, week, child, buttonpane;
@@ -90,8 +90,8 @@ test( "base structure", function() {
9090
step1();
9191
} );
9292

93-
test( "Localization", function() {
94-
expect( 10 );
93+
test( "Localization", function( assert ) {
94+
assert.expect( 10 );
9595

9696
var that = this,
9797
date = new Date( 2014, 0, 1 ),
@@ -142,7 +142,7 @@ test( "Localization", function() {
142142
} );
143143

144144
asyncTest( "keyboard handling", function( assert ) {
145-
expect( 10 );
145+
assert.expect( 10 );
146146

147147
var that = this;
148148

@@ -313,7 +313,7 @@ asyncTest( "keyboard handling", function( assert ) {
313313
} );
314314

315315
asyncTest( "mouse", function( assert ) {
316-
expect( 6 );
316+
assert.expect( 6 );
317317

318318
var that = this,
319319
date = new Date();

tests/unit/calendar/events.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module( "calendar: events", {
1010
}
1111
} );
1212

13-
test( "change", function() {
14-
expect( 6 );
13+
test( "change", function( assert ) {
14+
assert.expect( 6 );
1515

1616
var shouldFire, eventType;
1717

@@ -46,8 +46,8 @@ test( "change", function() {
4646
this.element.find( "tbody button" ).first().simulate( eventType );
4747
} );
4848

49-
asyncTest( "select", function() {
50-
expect( 6 );
49+
asyncTest( "select", function( assert ) {
50+
assert.expect( 6 );
5151

5252
var that = this,
5353
message, eventType;

tests/unit/calendar/methods.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module( "calendar: methods", {
1414
} );
1515

1616
test( "destroy", function( assert ) {
17-
expect( 1 );
17+
assert.expect( 1 );
1818

1919
var div = $( "<div>" ).appendTo( "#qunit-fixture" );
2020

@@ -23,8 +23,8 @@ test( "destroy", function( assert ) {
2323
} );
2424
} );
2525

26-
test( "enable / disable", function() {
27-
expect( 8 );
26+
test( "enable / disable", function( assert ) {
27+
assert.expect( 8 );
2828

2929
this.element.calendar( "disable" );
3030
ok( this.element.calendar( "option", "disabled" ), "disabled option is set" );
@@ -39,14 +39,14 @@ test( "enable / disable", function() {
3939
equal( this.element.attr( "aria-disabled" ), "false", "no longer has ARIA disabled" );
4040
} );
4141

42-
test( "widget", function() {
43-
expect( 1 );
42+
test( "widget", function( assert ) {
43+
assert.expect( 1 );
4444

4545
strictEqual( this.widget[ 0 ], this.element[ 0 ] );
4646
} );
4747

48-
test( "value", function() {
49-
expect( 3 );
48+
test( "value", function( assert ) {
49+
assert.expect( 3 );
5050

5151
this.element.calendar( "value", "1/1/14" );
5252
ok( this.element.find( "button[data-timestamp]:first" )
@@ -60,7 +60,7 @@ test( "value", function() {
6060
} );
6161

6262
test( "valueAsDate", function( assert ) {
63-
expect( 11 );
63+
assert.expect( 11 );
6464

6565
var minDate, maxDate, dateAndTimeToSet, dateAndTimeClone,
6666
date1 = new Date( 2008, 6 - 1, 4 ),

tests/unit/calendar/options.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module( "calendar: options", {
1313
}
1414
} );
1515

16-
test( "buttons", function() {
17-
expect( 21 );
16+
test( "buttons", function( assert ) {
17+
assert.expect( 21 );
1818

1919
var button, i, newButtons,
2020
that = this,
@@ -86,8 +86,8 @@ test( "buttons", function() {
8686
equal( this.element.hasClass( "ui-calendar-buttons" ), false, "calendar element removes class about having buttons" );
8787
} );
8888

89-
test( "buttons - advanced", function() {
90-
expect( 7 );
89+
test( "buttons - advanced", function( assert ) {
90+
assert.expect( 7 );
9191

9292
var that = this,
9393
buttons;
@@ -115,8 +115,8 @@ test( "buttons - advanced", function() {
115115
buttons.click();
116116
} );
117117

118-
test( "dateFormat", function() {
119-
expect( 2 );
118+
test( "dateFormat", function( assert ) {
119+
assert.expect( 2 );
120120

121121
this.element.calendar( "value", "1/1/14" );
122122

@@ -127,8 +127,8 @@ test( "dateFormat", function() {
127127
equal( this.element.calendar( "value" ), "Wednesday, January 1, 2014", "updated formatting" );
128128
} );
129129

130-
test( "eachDay", function() {
131-
expect( 5 );
130+
test( "eachDay", function( assert ) {
131+
assert.expect( 5 );
132132

133133
var timestamp,
134134
firstCell = this.widget.find( "td[id]:first" );
@@ -187,7 +187,7 @@ test( "showWeek", function() {
187187
} );
188188

189189
test( "min / max", function( assert ) {
190-
expect( 17 );
190+
assert.expect( 17 );
191191

192192
// With existing date
193193
var prevButton = this.widget.find( ".ui-calendar-prev" ),
@@ -264,8 +264,8 @@ test( "min / max", function( assert ) {
264264
ok( !prevButton.hasClass( "ui-state-disabled" ), "Other year below min: Prev button enabled after click" );
265265
} );
266266

267-
test( "numberOfMonths", function() {
268-
expect( 6 );
267+
test( "numberOfMonths", function( assert ) {
268+
assert.expect( 6 );
269269

270270
var date = new Date( 2015, 8 - 1, 1 );
271271

@@ -311,7 +311,7 @@ test( "numberOfMonths", function() {
311311
} );
312312

313313
test( "value", function( assert ) {
314-
expect( 4 );
314+
assert.expect( 4 );
315315

316316
var date = new Date( 2016, 5 - 1, 23 );
317317

tests/unit/datepicker/core.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module( "datepicker: core", {
1313
}
1414
} );
1515

16-
test( "input's value determines starting date", function() {
17-
expect( 3 );
16+
test( "input's value determines starting date", function( assert ) {
17+
assert.expect( 3 );
1818

1919
this.element = $( "<input>" ).appendTo( "#qunit-fixture" );
2020
this.element.val( "1/1/14" ).datepicker();
@@ -27,8 +27,8 @@ test( "input's value determines starting date", function() {
2727
equal( this.widget.find( ".ui-state-active" ).html(), "1", "correct day highlighted" );
2828
} );
2929

30-
asyncTest( "base structure", function() {
31-
expect( 5 );
30+
asyncTest( "base structure", function( assert ) {
31+
assert.expect( 5 );
3232

3333
var that = this;
3434

@@ -46,8 +46,8 @@ asyncTest( "base structure", function() {
4646
}, 50 );
4747
} );
4848

49-
asyncTest( "Keyboard handling: focus", function() {
50-
expect( 2 );
49+
asyncTest( "Keyboard handling: focus", function( assert ) {
50+
assert.expect( 2 );
5151

5252
var that = this;
5353

@@ -60,8 +60,8 @@ asyncTest( "Keyboard handling: focus", function() {
6060
}, 100 );
6161
} );
6262

63-
asyncTest( "Keyboard handling: keystroke up", function() {
64-
expect( 2 );
63+
asyncTest( "Keyboard handling: keystroke up", function( assert ) {
64+
assert.expect( 2 );
6565

6666
var that = this;
6767

@@ -75,7 +75,7 @@ asyncTest( "Keyboard handling: keystroke up", function() {
7575
} );
7676

7777
test( "Keyboard handling: input", function( assert ) {
78-
expect( 6 );
78+
assert.expect( 6 );
7979

8080
var that = this,
8181
instance = that.element.datepicker( "instance" );
@@ -125,7 +125,7 @@ test( "ARIA", function() {
125125
} );
126126

127127
asyncTest( "mouse", function( assert ) {
128-
expect( 4 );
128+
assert.expect( 4 );
129129

130130
var that = this;
131131

tests/unit/datepicker/events.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module( "datepicker: events", {
1313
}
1414
} );
1515

16-
test( "beforeOpen", function() {
17-
expect( 3 );
16+
test( "beforeOpen", function( assert ) {
17+
assert.expect( 3 );
1818

1919
var that = this;
2020

@@ -42,8 +42,8 @@ test( "beforeOpen", function() {
4242
.datepicker( "open" );
4343
} );
4444

45-
test( "change", function() {
46-
expect( 4 );
45+
test( "change", function( assert ) {
46+
assert.expect( 4 );
4747

4848
var shouldFire;
4949

@@ -71,8 +71,8 @@ test( "change", function() {
7171
this.widget.find( "tbody button" ).eq( 2 ).simulate( "mousedown" );
7272
} );
7373

74-
test( "close", function() {
75-
expect( 4 );
74+
test( "close", function( assert ) {
75+
assert.expect( 4 );
7676

7777
var shouldFire;
7878

@@ -103,8 +103,8 @@ test( "close", function() {
103103
this.widget.find( "tbody tr:first button:first" ).simulate( "mousedown" );
104104
} );
105105

106-
test( "open", function() {
107-
expect( 2 );
106+
test( "open", function( assert ) {
107+
assert.expect( 2 );
108108

109109
var that = this;
110110

@@ -118,8 +118,8 @@ test( "open", function() {
118118
this.element.datepicker( "open" );
119119
} );
120120

121-
asyncTest( "select", function() {
122-
expect( 4 );
121+
asyncTest( "select", function( assert ) {
122+
assert.expect( 4 );
123123

124124
var message = "",
125125
that = this;

tests/unit/datepicker/methods.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module( "datepicker: methods", {
1414
} );
1515

1616
test( "destroy", function( assert ) {
17-
expect( 3 );
17+
assert.expect( 3 );
1818

1919
var input = $( "<input>" ).appendTo( "#qunit-fixture" );
2020

@@ -26,8 +26,8 @@ test( "destroy", function( assert ) {
2626
} );
2727
} );
2828

29-
test( "enable / disable", function() {
30-
expect( 10 );
29+
test( "enable / disable", function( assert ) {
30+
assert.expect( 10 );
3131

3232
this.element.datepicker( "disable" );
3333
ok( this.element.datepicker( "option", "disabled" ), "disabled option is set" );
@@ -44,15 +44,15 @@ test( "enable / disable", function() {
4444
equal( this.element.attr( "disabled" ), undefined, "input no longer disabled" );
4545
} );
4646

47-
test( "widget", function() {
48-
expect( 1 );
47+
test( "widget", function( assert ) {
48+
assert.expect( 1 );
4949

5050
deepEqual( $( "body > .ui-front" )[ 0 ], this.widget[ 0 ] );
5151
this.widget.remove();
5252
} );
5353

54-
test( "open / close", function() {
55-
expect( 7 );
54+
test( "open / close", function( assert ) {
55+
assert.expect( 7 );
5656

5757
ok( this.widget.is( ":hidden" ), "calendar hidden on init" );
5858

@@ -67,8 +67,8 @@ test( "open / close", function() {
6767
equal( this.widget.attr( "aria-expanded" ), "false", "close: calendar aria-expanded" );
6868
} );
6969

70-
test( "value", function() {
71-
expect( 4 );
70+
test( "value", function( assert ) {
71+
assert.expect( 4 );
7272

7373
this.element.datepicker( "value", "1/1/14" );
7474
equal( this.element.val(), "1/1/14", "input's value set" );
@@ -85,7 +85,7 @@ test( "value", function() {
8585
} );
8686

8787
test( "valueAsDate", function( assert ) {
88-
expect( 5 );
88+
assert.expect( 5 );
8989

9090
strictEqual( this.element.datepicker( "valueAsDate" ), null, "Default" );
9191

@@ -101,8 +101,8 @@ test( "valueAsDate", function( assert ) {
101101
equal( this.element.datepicker( "valueAsDate" ), null, "Invalid dates return null" );
102102
} );
103103

104-
test( "isValid", function() {
105-
expect( 2 );
104+
test( "isValid", function( assert ) {
105+
assert.expect( 2 );
106106

107107
this.element.val( "1/1/14" );
108108
ok( this.element.datepicker( "isValid" ) );

0 commit comments

Comments
 (0)