@@ -38,10 +38,39 @@ module.exports.describe = function({testRunner, expect, playwright, headless, FF
38
38
expect ( await page . evaluate ( ( ) => window . innerWidth ) ) . toBe ( 123 ) ;
39
39
expect ( await page . evaluate ( ( ) => window . innerHeight ) ) . toBe ( 456 ) ;
40
40
} ) ;
41
- xit ( 'should emulate *- device-width media queries' , async ( { page, server} ) => {
41
+ it . fail ( WEBKIT || FFOX ) ( 'should emulate device-width media queries' , async ( { page, server} ) => {
42
42
expect ( page . viewportSize ( ) ) . toEqual ( { width : 1280 , height : 720 } ) ;
43
- await page . setViewportSize ( { width : 1800 , height : 456 } ) ;
44
- expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-width: 1800px)' ) . matches ) ) . toBe ( true ) ;
43
+ await page . setViewportSize ( { width : 200 , height : 200 } ) ;
44
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-width: 100px)' ) . matches ) ) . toBe ( true ) ;
45
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-width: 300px)' ) . matches ) ) . toBe ( false ) ;
46
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-width: 100px)' ) . matches ) ) . toBe ( false ) ;
47
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-width: 300px)' ) . matches ) ) . toBe ( true ) ;
48
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-width: 500px)' ) . matches ) ) . toBe ( false ) ;
49
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-width: 200px)' ) . matches ) ) . toBe ( true ) ;
50
+ await page . setViewportSize ( { width : 500 , height : 500 } ) ;
51
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-width: 400px)' ) . matches ) ) . toBe ( true ) ;
52
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-width: 600px)' ) . matches ) ) . toBe ( false ) ;
53
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-width: 400px)' ) . matches ) ) . toBe ( false ) ;
54
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-width: 600px)' ) . matches ) ) . toBe ( true ) ;
55
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-width: 200px)' ) . matches ) ) . toBe ( false ) ;
56
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-width: 500px)' ) . matches ) ) . toBe ( true ) ;
57
+ } ) ;
58
+ it . fail ( WEBKIT || FFOX ) ( 'should emulate device-height media queries' , async ( { page, server} ) => {
59
+ expect ( page . viewportSize ( ) ) . toEqual ( { width : 1280 , height : 720 } ) ;
60
+ await page . setViewportSize ( { width : 200 , height : 200 } ) ;
61
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-height: 100px)' ) . matches ) ) . toBe ( true ) ;
62
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-height: 300px)' ) . matches ) ) . toBe ( false ) ;
63
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-height: 100px)' ) . matches ) ) . toBe ( false ) ;
64
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-height: 300px)' ) . matches ) ) . toBe ( true ) ;
65
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-height: 500px)' ) . matches ) ) . toBe ( false ) ;
66
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-height: 200px)' ) . matches ) ) . toBe ( true ) ;
67
+ await page . setViewportSize ( { width : 500 , height : 500 } ) ;
68
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-height: 400px)' ) . matches ) ) . toBe ( true ) ;
69
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(min-device-height: 600px)' ) . matches ) ) . toBe ( false ) ;
70
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-height: 400px)' ) . matches ) ) . toBe ( false ) ;
71
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(max-device-height: 600px)' ) . matches ) ) . toBe ( true ) ;
72
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-height: 200px)' ) . matches ) ) . toBe ( false ) ;
73
+ expect ( await page . evaluate ( ( ) => matchMedia ( '(device-height: 500px)' ) . matches ) ) . toBe ( true ) ;
45
74
} ) ;
46
75
it ( 'should not have touch by default' , async ( { page, server} ) => {
47
76
await page . goto ( server . PREFIX + '/mobile.html' ) ;
0 commit comments