You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 3, 2024. It is now read-only.
ok(true,'window.matchMedia exists, these tests are using the native method');
186
+
}
187
+
var
188
+
W=$(window).width(),
189
+
H=$(window).height(),
190
+
DW=screen.width,
191
+
DH=screen.height,
192
+
O=W>H ? 'landscape' : 'portrait';
193
+
194
+
// orientation
195
+
ok(eCSStender.matchMedia('screen and (orientation:portrait)')==(O=='portrait'),'(orientation:portrait) '+(O=='portrait' ? 'matched' : 'does not match'));
196
+
ok(eCSStender.matchMedia('screen and (orientation:landscape)')==(O=='landscape'),'(orientation:landscape) '+(O=='landscape' ? 'matched' : 'does not match'));
197
+
198
+
// width
199
+
ok(eCSStender.matchMedia('screen and (width:'+W+'px)'),'width set to window width matches');
200
+
ok(!eCSStender.matchMedia('screen and (width:'+(W-100)+'px)'),'width set to window width - 100 does not match');
201
+
ok(!eCSStender.matchMedia('screen and (width:'+(W+100)+'px)'),'width set to window width + 100 does not match');
202
+
203
+
// max-width
204
+
ok(eCSStender.matchMedia('screen and (max-width:'+W+'px)'),'max-width set to window width matches');
205
+
ok(!eCSStender.matchMedia('screen and (max-width:'+(W-100)+'px)'),'max-width set to window width - 100 does not match');
206
+
ok(eCSStender.matchMedia('screen and (max-width:'+(W+100)+'px)'),'max-width set to window width + 100 matches');
207
+
208
+
// min-width
209
+
ok(eCSStender.matchMedia('screen and (min-width:'+W+'px)'),'min-width set to window width matches');
210
+
ok(eCSStender.matchMedia('screen and (min-width:'+(W-100)+'px)'),'min-width set to window width - 100 matches');
211
+
ok(!eCSStender.matchMedia('screen and (min-width:'+(W+100)+'px)'),'min-width set to window width + 100 does not match');
212
+
213
+
// device-width
214
+
ok(eCSStender.matchMedia('screen and (device-width:'+DW+'px)'),'device-width set to device-width matches');
215
+
ok(!eCSStender.matchMedia('screen and (device-width:'+(DW-100)+'px)'),'device-width set to device-width - 100 does not match');
216
+
ok(!eCSStender.matchMedia('screen and (device-width:'+(DW+100)+'px)'),'device-width set to device-width + 100 does not match');
217
+
218
+
// max-device-width
219
+
ok(eCSStender.matchMedia('screen and (max-device-width:'+DW+'px)'),'max-device-width set to device-width matches');
220
+
ok(!eCSStender.matchMedia('screen and (max-device-width:'+(DW-100)+'px)'),'max-device-width set to device-width - 100 does not match');
221
+
ok(eCSStender.matchMedia('screen and (max-device-width:'+(DW+100)+'px)'),'max-device-width set to device-width + 100 matches');
222
+
223
+
// min-device-width
224
+
ok(eCSStender.matchMedia('screen and (min-device-width:'+DW+'px)'),'min-device-width set to device-width matches');
225
+
ok(eCSStender.matchMedia('screen and (min-device-width:'+(DW-100)+'px)'),'min-device-width set to device-width - 100 matches');
226
+
ok(!eCSStender.matchMedia('screen and (min-device-width:'+(DW+100)+'px)'),'min-device-width set to device-width + 100 does not match');
227
+
228
+
// height
229
+
ok(eCSStender.matchMedia('screen and (height:'+H+'px)'),'height set to window height matches');
230
+
ok(!eCSStender.matchMedia('screen and (height:'+(H-100)+'px)'),'height set to window height - 100 does not match');
231
+
ok(!eCSStender.matchMedia('screen and (height:'+(H+100)+'px)'),'height set to window height + 100 does not match');
232
+
233
+
// max-height
234
+
ok(eCSStender.matchMedia('screen and (max-height:'+H+'px)'),'max-height set to window height matches');
235
+
ok(!eCSStender.matchMedia('screen and (max-height:'+(H-100)+'px)'),'max-height set to window height - 100 does not match');
236
+
ok(eCSStender.matchMedia('screen and (max-height:'+(H+100)+'px)'),'max-height set to window height + 100 matches');
237
+
238
+
// min-height
239
+
ok(eCSStender.matchMedia('screen and (min-height:'+H+'px)'),'min-height set to window height matches');
240
+
ok(eCSStender.matchMedia('screen and (min-height:'+(H-100)+'px)'),'min-height set to window height - 100 matches');
241
+
ok(!eCSStender.matchMedia('screen and (min-height:'+(H+100)+'px)'),'min-height set to window height + 100 does not match');
242
+
243
+
// device-height
244
+
ok(eCSStender.matchMedia('screen and (device-height:'+DH+'px)'),'device-height set to device-height matches');
245
+
ok(!eCSStender.matchMedia('screen and (device-height:'+(DH-100)+'px)'),'device-height set to device-height - 100 does not match');
246
+
ok(!eCSStender.matchMedia('screen and (device-height:'+(DH+100)+'px)'),'device-height set to device-height + 100 does not match');
247
+
248
+
// max-device-height
249
+
ok(eCSStender.matchMedia('screen and (max-device-height:'+DH+'px)'),'max-device-height set to device-height matches');
250
+
ok(!eCSStender.matchMedia('screen and (max-device-height:'+(DH-100)+'px)'),'max-device-height set to device-height - 100 does not match');
251
+
ok(eCSStender.matchMedia('screen and (max-device-height:'+(DH+100)+'px)'),'max-device-height set to device-height + 100 matches');
252
+
253
+
// min-device-height
254
+
ok(eCSStender.matchMedia('screen and (min-device-height:'+DH+'px)'),'min-device-height set to device-height matches');
255
+
ok(eCSStender.matchMedia('screen and (min-device-height:'+(DH-100)+'px)'),'min-device-height set to device-height - 100 matches');
256
+
ok(!eCSStender.matchMedia('screen and (min-device-height:'+(DH+100)+'px)'),'min-device-height set to device-height + 100 does not match');
257
+
258
+
// complex rules
259
+
ok(eCSStender.matchMedia('screen and (min-width:'+(W-100)+'px) and (max-width:'+(W+100)+'px)'),''+'screen and (min-width:'+(W-100)+'px) and (max-width:'+(W+100)+'px) matches');
260
+
ok(eCSStender.matchMedia('screen and (min-height:'+(H-100)+'px) and (max-height:'+(H+100)+'px)'),''+'screen and (min-height:'+(H-100)+'px) and (max-height:'+(H+100)+'px) matches');
261
+
ok(eCSStender.matchMedia('screen and (min-width:'+(W-100)+'px), screen and (max-width:'+(W+100)+'px)'),''+'screen and (min-width:'+(W-100)+'px), screen and (max-width:'+(W+100)+'px) matches');
262
+
ok(eCSStender.matchMedia('screen and (min-width:'+(W-100)+'px) and (orientation:'+O+')'),''+'screen and (min-width:'+(W-100)+'px) and (orientation:'+O+') matches');
263
+
ok(!eCSStender.matchMedia('screen and (min-width:'+(W-100)+'px) and (orientation:'+(O=='portrait' ? 'landscape' : 'portrait')+')'),''+'screen and (min-width:'+(W-100)+'px) and (orientation:'+(O=='portrait' ? 'landscape' : 'portrait')+') does not match');
264
+
ok(!eCSStender.matchMedia('screen and (max-width:'+(W-100)+'px), screen and (orientation:'+(O=='portrait' ? 'landscape' : 'portrait')+')'),''+'screen and (max-width:'+(W-100)+'px), screen and (orientation:'+(O=='portrait' ? 'landscape' : 'portrait')+') does not match');
0 commit comments