chromium/third_party/blink/web_tests/fast/dynamic/hover-before-position-after-style-change.html

<!DOCTYPE HTML>
<html>
    <head>
        <style>
            div { width:100px; height:100px;}
            div#outsideDiv:before       { content:"> "; }
            div#outsideDiv:hover:before { content:"< "; }
        </style>
        <p>
            Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=56401">https://bugs.webkit.org/show_bug.cgi?id=56401</a>
            Hover the mouse over the "Inline" text. The test passes if "Inline" is not placed on a new line.
        </p>
    </head>
    <body>
        <div id="console"></div>
        <div id="outsideDiv" onmouseover="checkTestResult()">
            <span>Inline</span>
            <div id="insideDiv">Block</p>
        </div>
        <script>
            function getElementTop(elementId)
            {
                var elem = document.getElementById(elementId);
                return elem.getBoundingClientRect().top;
            }

            function simulateMouseMove()
            {
                var outsideDivTop = getElementTop("outsideDiv");
                if (window.eventSender)
                    eventSender.mouseMoveTo(50, outsideDivTop);
            }

            function checkTestResult()
            {
                var outsideDivTop = getElementTop("outsideDiv");
                var insideDivTop = getElementTop("insideDiv");
                document.getElementById("console").innerText = (insideDivOriginalTop != insideDivTop) ? "FAIL" : "PASS";
                if (window.testRunner)
                    document.getElementById("outsideDiv").style.visibility = 'hidden';
            }

            if (window.testRunner)
                testRunner.dumpAsText();

            document.body.offsetTop;
            // Capture the initial values for inside div top
            var insideDivOriginalTop = getElementTop("insideDiv");

            if (window.testRunner) {
                simulateMouseMove();
                checkTestResult();
            }
        </script>
    </body>
</html>