@@ -53,52 +53,52 @@ test("widget method", function() {
53
53
} ) ;
54
54
55
55
test ( 'baseStructure' , function ( ) {
56
- var inp = init ( '#inp' ) ;
57
- inp . focus ( ) ;
58
- var dp = $ ( '#ui-datepicker-div' ) ;
59
- var iframe = ( $ . browser . msie && parseInt ( $ . browser . version ) < 7 ) ;
56
+ var header , title , table , thead , week , panel , inl , child ,
57
+ inp = init ( '#inp' ) . focus ( ) ,
58
+ dp = $ ( '#ui-datepicker-div' ) ,
59
+ iframe = ( $ . browser . msie && parseInt ( $ . browser . version , 10 ) < 7 ) ;
60
60
ok ( dp . is ( ':visible' ) , 'Structure - datepicker visible' ) ;
61
61
ok ( ! dp . is ( '.ui-datepicker-rtl' ) , 'Structure - not right-to-left' ) ;
62
62
ok ( ! dp . is ( '.ui-datepicker-multi' ) , 'Structure - not multi-month' ) ;
63
63
equal ( dp . children ( ) . length , 2 + ( iframe ? 1 : 0 ) , 'Structure - child count' ) ;
64
64
65
- var header = dp . children ( ':first' ) ;
65
+ header = dp . children ( ':first' ) ;
66
66
ok ( header . is ( 'div.ui-datepicker-header' ) , 'Structure - header division' ) ;
67
67
equal ( header . children ( ) . length , 3 , 'Structure - header child count' ) ;
68
- ok ( header . children ( ':first' ) . is ( 'a.ui-datepicker-prev' ) && header . children ( ':first' ) . html ( ) != '' , 'Structure - prev link' ) ;
69
- ok ( header . children ( ':eq(1)' ) . is ( 'a.ui-datepicker-next' ) && header . children ( ':eq(1)' ) . html ( ) != '' , 'Structure - next link' ) ;
68
+ ok ( header . children ( ':first' ) . is ( 'a.ui-datepicker-prev' ) && header . children ( ':first' ) . html ( ) !== '' , 'Structure - prev link' ) ;
69
+ ok ( header . children ( ':eq(1)' ) . is ( 'a.ui-datepicker-next' ) && header . children ( ':eq(1)' ) . html ( ) !== '' , 'Structure - next link' ) ;
70
70
71
- var title = header . children ( ':last' ) ;
72
- ok ( title . is ( 'div.ui-datepicker-title' ) && title . html ( ) != '' , 'Structure - title division' ) ;
71
+ title = header . children ( ':last' ) ;
72
+ ok ( title . is ( 'div.ui-datepicker-title' ) && title . html ( ) !== '' , 'Structure - title division' ) ;
73
73
equal ( title . children ( ) . length , 2 , 'Structure - title child count' ) ;
74
- ok ( title . children ( ':first' ) . is ( 'span.ui-datepicker-month' ) && title . children ( ':first' ) . text ( ) != '' , 'Structure - month text' )
75
- ok ( title . children ( ':last' ) . is ( 'span.ui-datepicker-year' ) && title . children ( ':last' ) . text ( ) != '' , 'Structure - year text' )
74
+ ok ( title . children ( ':first' ) . is ( 'span.ui-datepicker-month' ) && title . children ( ':first' ) . text ( ) !== '' , 'Structure - month text' ) ;
75
+ ok ( title . children ( ':last' ) . is ( 'span.ui-datepicker-year' ) && title . children ( ':last' ) . text ( ) !== '' , 'Structure - year text' ) ;
76
76
77
- var table = dp . children ( ':eq(1)' ) ;
77
+ table = dp . children ( ':eq(1)' ) ;
78
78
ok ( table . is ( 'table.ui-datepicker-calendar' ) , 'Structure - month table' ) ;
79
79
ok ( table . children ( ':first' ) . is ( 'thead' ) , 'Structure - month table thead' ) ;
80
- var thead = table . children ( ':first' ) . children ( ':first' ) ;
80
+ thead = table . children ( ':first' ) . children ( ':first' ) ;
81
81
ok ( thead . is ( 'tr' ) , 'Structure - month table title row' ) ;
82
82
equal ( thead . find ( 'th' ) . length , 7 , 'Structure - month table title cells' ) ;
83
83
ok ( table . children ( ':eq(1)' ) . is ( 'tbody' ) , 'Structure - month table body' ) ;
84
84
ok ( table . children ( ':eq(1)' ) . children ( 'tr' ) . length >= 4 , 'Structure - month table week count' ) ;
85
- var week = table . children ( ':eq(1)' ) . children ( ':first' ) ;
85
+ week = table . children ( ':eq(1)' ) . children ( ':first' ) ;
86
86
ok ( week . is ( 'tr' ) , 'Structure - month table week row' ) ;
87
87
equal ( week . children ( ) . length , 7 , 'Structure - week child count' ) ;
88
88
ok ( week . children ( ':first' ) . is ( 'td.ui-datepicker-week-end' ) , 'Structure - month table first day cell' ) ;
89
89
ok ( week . children ( ':last' ) . is ( 'td.ui-datepicker-week-end' ) , 'Structure - month table second day cell' ) ;
90
- ok ( dp . children ( 'iframe' ) . length == ( iframe ? 1 : 0 ) , 'Structure - iframe' ) ;
90
+ ok ( dp . children ( 'iframe' ) . length === ( iframe ? 1 : 0 ) , 'Structure - iframe' ) ;
91
91
inp . datepicker ( 'hide' ) . datepicker ( 'destroy' ) ;
92
92
93
93
// Editable month/year and button panel
94
94
inp = init ( '#inp' , { changeMonth : true , changeYear : true , showButtonPanel : true } ) ;
95
95
inp . focus ( ) ;
96
96
97
- var title = dp . find ( 'div.ui-datepicker-title' ) ;
97
+ title = dp . find ( 'div.ui-datepicker-title' ) ;
98
98
ok ( title . children ( ':first' ) . is ( 'select.ui-datepicker-month' ) , 'Structure - month selector' ) ;
99
99
ok ( title . children ( ':last' ) . is ( 'select.ui-datepicker-year' ) , 'Structure - year selector' ) ;
100
100
101
- var panel = dp . children ( ':last' ) ;
101
+ panel = dp . children ( ':last' ) ;
102
102
ok ( panel . is ( 'div.ui-datepicker-buttonpane' ) , 'Structure - button panel division' ) ;
103
103
equal ( panel . children ( ) . length , 2 , 'Structure - button panel child count' ) ;
104
104
ok ( panel . children ( ':first' ) . is ( 'button.ui-datepicker-current' ) , 'Structure - today button' ) ;
@@ -110,7 +110,7 @@ test('baseStructure', function() {
110
110
inp . focus ( ) ;
111
111
ok ( dp . is ( '.ui-datepicker-multi' ) , 'Structure multi [2] - multi-month' ) ;
112
112
equal ( dp . children ( ) . length , 3 + ( iframe ? 1 : 0 ) , 'Structure multi [2] - child count' ) ;
113
- var child = dp . children ( ':first' ) ;
113
+ child = dp . children ( ':first' ) ;
114
114
ok ( child . is ( 'div.ui-datepicker-group' ) && child . is ( 'div.ui-datepicker-group-first' ) , 'Structure multi [2] - first month division' ) ;
115
115
child = dp . children ( ':eq(1)' ) ;
116
116
ok ( child . is ( 'div.ui-datepicker-group' ) && child . is ( 'div.ui-datepicker-group-last' ) , 'Structure multi [2] - second month division' ) ;
@@ -146,16 +146,16 @@ test('baseStructure', function() {
146
146
inp . datepicker ( 'hide' ) . datepicker ( 'destroy' ) ;
147
147
148
148
// Inline
149
- var inl = init ( '#inl' ) ;
149
+ inl = init ( '#inl' ) ;
150
150
dp = inl . children ( ) ;
151
151
ok ( dp . is ( '.ui-datepicker-inline' ) , 'Structure inline - main div' ) ;
152
152
ok ( ! dp . is ( '.ui-datepicker-rtl' ) , 'Structure inline - not right-to-left' ) ;
153
153
ok ( ! dp . is ( '.ui-datepicker-multi' ) , 'Structure inline - not multi-month' ) ;
154
154
equal ( dp . children ( ) . length , 2 , 'Structure inline - child count' ) ;
155
- var header = dp . children ( ':first' ) ;
155
+ header = dp . children ( ':first' ) ;
156
156
ok ( header . is ( 'div.ui-datepicker-header' ) , 'Structure inline - header division' ) ;
157
157
equal ( header . children ( ) . length , 3 , 'Structure inline - header child count' ) ;
158
- var table = dp . children ( ':eq(1)' ) ;
158
+ table = dp . children ( ':eq(1)' ) ;
159
159
ok ( table . is ( 'table.ui-datepicker-calendar' ) , 'Structure inline - month table' ) ;
160
160
ok ( table . children ( ':first' ) . is ( 'thead' ) , 'Structure inline - month table thead' ) ;
161
161
ok ( table . children ( ':eq(1)' ) . is ( 'tbody' ) , 'Structure inline - month table body' ) ;
@@ -176,19 +176,20 @@ test('baseStructure', function() {
176
176
} ) ;
177
177
178
178
test ( 'customStructure' , function ( ) {
179
- var dp = $ ( '#ui-datepicker-div' ) ;
180
- // Check right-to-left localisation
181
- var inp = init ( '#inp' , $ . datepicker . regional [ 'he' ] ) ;
179
+ var iframe , header , panel , title , thead ,
180
+ dp = $ ( '#ui-datepicker-div' ) ,
181
+ // Check right-to-left localisation
182
+ inp = init ( '#inp' , $ . datepicker . regional . he ) ;
182
183
inp . data ( 'showButtonPanel.datepicker' , true ) ;
183
184
inp . focus ( ) ;
184
- var iframe = ( $ . browser . msie && parseInt ( $ . browser . version ) < 7 ) ;
185
+ iframe = ( $ . browser . msie && parseInt ( $ . browser . version , 10 ) < 7 ) ;
185
186
ok ( dp . is ( '.ui-datepicker-rtl' ) , 'Structure RTL - right-to-left' ) ;
186
- var header = dp . children ( ':first' ) ;
187
+ header = dp . children ( ':first' ) ;
187
188
ok ( header . is ( 'div.ui-datepicker-header' ) , 'Structure RTL - header division' ) ;
188
189
equal ( header . children ( ) . length , 3 , 'Structure RTL - header child count' ) ;
189
190
ok ( header . children ( ':first' ) . is ( 'a.ui-datepicker-next' ) , 'Structure RTL - prev link' ) ;
190
191
ok ( header . children ( ':eq(1)' ) . is ( 'a.ui-datepicker-prev' ) , 'Structure RTL - next link' ) ;
191
- var panel = dp . children ( ':last' ) ;
192
+ panel = dp . children ( ':last' ) ;
192
193
ok ( panel . is ( 'div.ui-datepicker-buttonpane' ) , 'Structure RTL - button division' ) ;
193
194
equal ( panel . children ( ) . length , 2 , 'Structure RTL - button panel child count' ) ;
194
195
ok ( panel . children ( ':first' ) . is ( 'button.ui-datepicker-close' ) , 'Structure RTL - close button' ) ;
@@ -198,7 +199,7 @@ test('customStructure', function() {
198
199
// Hide prev/next
199
200
inp = init ( '#inp' , { hideIfNoPrevNext : true , minDate : new Date ( 2008 , 2 - 1 , 4 ) , maxDate : new Date ( 2008 , 2 - 1 , 14 ) } ) ;
200
201
inp . val ( '02/10/2008' ) . focus ( ) ;
201
- var header = dp . children ( ':first' ) ;
202
+ header = dp . children ( ':first' ) ;
202
203
ok ( header . is ( 'div.ui-datepicker-header' ) , 'Structure hide prev/next - header division' ) ;
203
204
equal ( header . children ( ) . length , 1 , 'Structure hide prev/next - links child count' ) ;
204
205
ok ( header . children ( ':first' ) . is ( 'div.ui-datepicker-title' ) , 'Structure hide prev/next - title division' ) ;
@@ -207,7 +208,7 @@ test('customStructure', function() {
207
208
// Changeable Month with read-only year
208
209
inp = init ( '#inp' , { changeMonth : true } ) ;
209
210
inp . focus ( ) ;
210
- var title = dp . children ( ':first' ) . children ( ':last' ) ;
211
+ title = dp . children ( ':first' ) . children ( ':last' ) ;
211
212
equal ( title . children ( ) . length , 2 , 'Structure changeable month - title child count' ) ;
212
213
ok ( title . children ( ':first' ) . is ( 'select.ui-datepicker-month' ) , 'Structure changeable month - month selector' ) ;
213
214
ok ( title . children ( ':last' ) . is ( 'span.ui-datepicker-year' ) , 'Structure changeable month - read-only year' ) ;
@@ -216,7 +217,7 @@ test('customStructure', function() {
216
217
// Changeable year with read-only month
217
218
inp = init ( '#inp' , { changeYear : true } ) ;
218
219
inp . focus ( ) ;
219
- var title = dp . children ( ':first' ) . children ( ':last' ) ;
220
+ title = dp . children ( ':first' ) . children ( ':last' ) ;
220
221
equal ( title . children ( ) . length , 2 , 'Structure changeable year - title child count' ) ;
221
222
ok ( title . children ( ':first' ) . is ( 'span.ui-datepicker-month' ) , 'Structure changeable year - read-only month' ) ;
222
223
ok ( title . children ( ':last' ) . is ( 'select.ui-datepicker-year' ) , 'Structure changeable year - year selector' ) ;
@@ -225,15 +226,15 @@ test('customStructure', function() {
225
226
// Read-only first day of week
226
227
inp = init ( '#inp' , { changeFirstDay : false } ) ;
227
228
inp . focus ( ) ;
228
- var thead = dp . find ( '.ui-datepicker-calendar thead tr' ) ;
229
+ thead = dp . find ( '.ui-datepicker-calendar thead tr' ) ;
229
230
equal ( thead . children ( ) . length , 7 , 'Structure read-only first day - thead child count' ) ;
230
231
equal ( thead . find ( 'a' ) . length , 0 , 'Structure read-only first day - thead links count' ) ;
231
232
inp . datepicker ( 'hide' ) . datepicker ( 'destroy' ) ;
232
233
} ) ;
233
234
234
235
test ( 'keystrokes' , function ( ) {
235
- var inp = init ( '#inp' ) ;
236
- var date = new Date ( ) ;
236
+ var inp = init ( '#inp' ) ,
237
+ date = new Date ( ) ;
237
238
inp . val ( '' ) . datepicker ( 'show' ) .
238
239
simulate ( 'keydown' , { keyCode : $ . ui . keyCode . ENTER } ) ;
239
240
equalsDate ( inp . datepicker ( 'getDate' ) , date , 'Keystroke enter' ) ;
@@ -366,9 +367,10 @@ test('keystrokes', function() {
366
367
} ) ;
367
368
368
369
test ( 'mouse' , function ( ) {
369
- var inp = init ( '#inp' ) ;
370
- var dp = $ ( '#ui-datepicker-div' ) ;
371
- var date = new Date ( ) ;
370
+ var inl ,
371
+ inp = init ( '#inp' ) ,
372
+ dp = $ ( '#ui-datepicker-div' ) ,
373
+ date = new Date ( ) ;
372
374
inp . val ( '' ) . datepicker ( 'show' ) ;
373
375
$ ( '.ui-datepicker-calendar tbody a:contains(10)' , dp ) . simulate ( 'click' , { } ) ;
374
376
date . setDate ( 10 ) ;
@@ -419,9 +421,9 @@ test('mouse', function() {
419
421
equalsDate ( inp . datepicker ( 'getDate' ) , new Date ( 2008 , 2 - 1 , 18 ) ,
420
422
'Mouse click - next + min/max' ) ;
421
423
// Inline
422
- var inl = init ( '#inl' ) ;
423
- var dp = $ ( '.ui-datepicker-inline' , inl ) ;
424
- var date = new Date ( ) ;
424
+ inl = init ( '#inl' ) ;
425
+ dp = $ ( '.ui-datepicker-inline' , inl ) ;
426
+ date = new Date ( ) ;
425
427
inl . datepicker ( 'setDate' , date ) ;
426
428
$ ( '.ui-datepicker-calendar tbody a:contains(10)' , dp ) . simulate ( 'click' , { } ) ;
427
429
date . setDate ( 10 ) ;
0 commit comments