summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/media/mq-width-on-zoom.html
blob: ad4f5e1d8b3dd70fcedd6e74dd373c5edc06845e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html>
    <head>
        <script src="../../resources/js-test.js"></script>
    </head>
    <body>
        <p>
            Tests that width MQ feature is correct on zoom.
        </p>
        <script>
            // eventSender.zoomPageOut/In zooms with a fixed factor of 1.2 instead
            // of the zoom levels of the actual browser.

            function test() {
                var minWidth = window.innerWidth - 1;
                var maxWidth = window.innerWidth + 1;
                shouldBeTrue("window.matchMedia('(min-width: " + minWidth + "px)').matches");
                shouldBeTrue("window.matchMedia('(max-width: " + maxWidth + "px)').matches");
            }

            if (window.eventSender) {
                for (var i = 0; i < 5; i++) {
                    eventSender.zoomPageOut();
                    test();
                }

                for (var i = 0; i < 10; i++) {
                    eventSender.zoomPageIn();
                    test();
                }
            }
        </script>
    </body>
</html>