accessible/tests/mochitest/events/test_flush.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/events/test_flush.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,77 @@
     1.4 +<html>
     1.5 +
     1.6 +<head>
     1.7 +  <title>Flush delayed events testing</title>
     1.8 +
     1.9 +  <link rel="stylesheet" type="text/css"
    1.10 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
    1.16 +
    1.17 +  <script type="application/javascript"
    1.18 +          src="../common.js"></script>
    1.19 +  <script type="application/javascript"
    1.20 +          src="../events.js"></script>
    1.21 +
    1.22 +  <script type="application/javascript">
    1.23 +    SimpleTest.expectAssertions(0, 1);
    1.24 +
    1.25 +    var gFocusHandler = {
    1.26 +      handleEvent: function(aEvent) {
    1.27 +        switch (this.count) {
    1.28 +          case 0:
    1.29 +            is(aEvent.DOMNode, getNode("input1"),
    1.30 +               "Focus event for input1 was expected!");
    1.31 +            getAccessible("input2").takeFocus();
    1.32 +            break;
    1.33 +
    1.34 +          case 1:
    1.35 +            is(aEvent.DOMNode, getNode("input2"),
    1.36 +               "Focus event for input2 was expected!");
    1.37 +
    1.38 +            unregisterA11yEventListener(EVENT_FOCUS, gFocusHandler);
    1.39 +            SimpleTest.finish();
    1.40 +            break;
    1.41 +
    1.42 +          default:
    1.43 +            ok(false, "Wrong focus event!");
    1.44 +        }
    1.45 +
    1.46 +        this.count++;
    1.47 +      },
    1.48 +
    1.49 +      count: 0
    1.50 +    };
    1.51 +
    1.52 +    function doTests()
    1.53 +    {
    1.54 +      registerA11yEventListener(EVENT_FOCUS, gFocusHandler);
    1.55 +
    1.56 +      getAccessible("input1").takeFocus();
    1.57 +    }
    1.58 +
    1.59 +    SimpleTest.waitForExplicitFinish();
    1.60 +    addA11yLoadEvent(doTests);
    1.61 +  </script>
    1.62 +</head>
    1.63 +
    1.64 +<body>
    1.65 +
    1.66 +  <a target="_blank"
    1.67 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=477551"
    1.68 +     title="DocAccessible::FlushPendingEvents isn't robust">
    1.69 +    Mozilla Bug 477551
    1.70 +  </a>
    1.71 +
    1.72 +  <p id="display"></p>
    1.73 +  <div id="content" style="display: none"></div>
    1.74 +  <pre id="test">
    1.75 +  </pre>
    1.76 +
    1.77 +  <input id="input1">
    1.78 +  <input id="input2">
    1.79 +</body>
    1.80 +</html>

mercurial