Revision d0d62244432d329aa22e9278d3e83184301c3e7f authored by Chris Nardi on 07 April 2018, 01:36:26 UTC, committed by Xidorn Quan on 07 April 2018, 02:05:46 UTC
See https://github.com/w3c/csswg-drafts/issues/2509#issuecomment-379152590 for the change to target9. Also remove the extra whitespace in target8 and target1 which causes these tests to fail in Chrome and Firefox.

Also remove testcase.propertyName from each test's name as this doesn't exist and just outputs undefined.
1 parent 6e68c44
Raw File
viewport-resize-event-manual.html
<!doctype html>
<html>
    <head>
        <title>Viewport: Window Resize Fires Event</title>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width">
        <script src="/resources/testharness.js"></script>
        <script src="/resources/testharnessreport.js"></script>
        <script src="viewport_support.js"></script>
        <script>
           setup({explicit_timeout: true, explicit_done: true})
        </script>
    </head>
    <body>
    <h1>Viewport: Window Resize Fires Event</h1>
    <h4>
        Test Description: This test checks that a resize event is fired against
        the window.visualViewport object when the browser window is resized.
    </h4>
    <h2 style="color: red">THIS IS A MANUAL TEST</h2>
    <p id="skip">
        <button id="skipbtn" onclick="skipManualTest();">Skip Test</button>
    </p>
    <p id="instruction"></p>
    <button id="continue">Start Test</button>
    <div id="log"></div>
    </body>
    <script>
        var continueBtn = document.getElementById("continue");

        function continueTest() {
          nextStep(function(instructionText) {
            var instruction = document.getElementById("instruction");
            continueBtn.innerText = "Continue";
            instruction.innerText = instructionText;
          });
        }

        continueBtn.addEventListener('click', continueTest);

        var didResizeView;
        var cancelable;
        var bubbles;

        function resetValues() {
            didResizeView = false;
            cancelable = undefined;
            bubbles = undefined;
        }

        addManualTestStep(
            function() {
                resetValues();
                window.visualViewport.addEventListener('resize', function(e) {
                    didResizeView = true;
                    cancelable = e.cancelable;
                    bubbles = e.bubbles;
                });
            },
            null,
            '1. Resize the browser window (if on mobile, rotate the device)');


        addManualTestStep(
            function() {
                assert_true(didResizeView);
                assert_false(cancelable);
                assert_false(bubbles);
             },
            'Resize event fired at window.visualViewport after window resized',
            '2. Unrotate the device or reset window size if needed.');

        addManualTestStep(
            resetValues,
            null,
            '3. Pinch-zoom anywhere on the page by any amount.');

        addManualTestStep(
            function() {
                assert_true(didResizeView);
                assert_false(cancelable);
                assert_false(bubbles);
            },
            'Pinch-zooming fires a resize event',
            '4. Pinch-zoom back out');

        addManualTestStep(
            function() { continueBtn.remove(); },
            null,
            'Test Complete');
    </script>
</html>
back to top