test_flush.html (1810B)
1 <html> 2 3 <head> 4 <title>Flush delayed events testing</title> 5 6 <link rel="stylesheet" type="text/css" 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 8 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 10 <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 11 12 <script type="application/javascript" 13 src="../common.js"></script> 14 <script type="application/javascript" 15 src="../events.js"></script> 16 17 <script type="application/javascript"> 18 SimpleTest.expectAssertions(0, 1); 19 20 var gFocusHandler = { 21 handleEvent(aEvent) { 22 switch (this.count) { 23 case 0: 24 is(aEvent.DOMNode, getNode("input1"), 25 "Focus event for input1 was expected!"); 26 getAccessible("input2").takeFocus(); 27 break; 28 29 case 1: 30 is(aEvent.DOMNode, getNode("input2"), 31 "Focus event for input2 was expected!"); 32 33 unregisterA11yEventListener(EVENT_FOCUS, gFocusHandler); 34 SimpleTest.finish(); 35 break; 36 37 default: 38 ok(false, "Wrong focus event!"); 39 } 40 41 this.count++; 42 }, 43 44 count: 0, 45 }; 46 47 function doTests() { 48 registerA11yEventListener(EVENT_FOCUS, gFocusHandler); 49 50 getAccessible("input1").takeFocus(); 51 } 52 53 SimpleTest.waitForExplicitFinish(); 54 addA11yLoadEvent(doTests); 55 </script> 56 </head> 57 58 <body> 59 60 <a target="_blank" 61 href="https://bugzilla.mozilla.org/show_bug.cgi?id=477551" 62 title="DocAccessible::FlushPendingEvents isn't robust"> 63 Mozilla Bug 477551 64 </a> 65 66 <p id="display"></p> 67 <div id="content" style="display: none"></div> 68 <pre id="test"> 69 </pre> 70 71 <input id="input1"> 72 <input id="input2"> 73 </body> 74 </html>