| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 |
| 5 <div id="wrapper1"> |
| 6 <button id="button1">Button</button> |
| 7 </div> |
| 8 |
| 9 <script> |
| 10 async_test(function(t) |
| 11 { |
| 12 var axButton = accessibilityController.accessibleElementById("button1"); |
| 13 axButton.addNotificationListener(function(notification) { |
| 14 if (notification == 'Clicked') { |
| 15 document.getElementById("wrapper1").style.display = "none"; |
| 16 t.done(); |
| 17 } |
| 18 }); |
| 19 |
| 20 var button = document.getElementById("button1"); |
| 21 button.click(); |
| 22 }, "clicking a button via javascript sends an accessible click event"); |
| 23 </script> |
| 24 |
| 25 <div id="wrapper2"> |
| 26 <button id="button2">Button</button> |
| 27 </div> |
| 28 |
| 29 <script> |
| 30 async_test(function(t) |
| 31 { |
| 32 var axButton = accessibilityController.accessibleElementById("button2"); |
| 33 axButton.addNotificationListener(function(notification) { |
| 34 if (notification == 'Clicked') { |
| 35 document.getElementById("wrapper2").style.display = "none"; |
| 36 t.done(); |
| 37 } |
| 38 }); |
| 39 |
| 40 eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); |
| 41 eventSender.mouseDown(); |
| 42 eventSender.mouseUp(); |
| 43 }, "clicking a button via mouse events sends an accessible click event"); |
| 44 </script> |
| 45 |
| 46 <div id="wrapper3"> |
| 47 <button id="button3">Button</button> |
| 48 </div> |
| 49 |
| 50 <script> |
| 51 async_test(function(t) |
| 52 { |
| 53 var axButton = accessibilityController.accessibleElementById("button3"); |
| 54 axButton.addNotificationListener(function(notification) { |
| 55 if (notification == 'Clicked') { |
| 56 document.getElementById("wrapper3").style.display = "none"; |
| 57 t.done(); |
| 58 } |
| 59 }); |
| 60 |
| 61 var button = document.getElementById("button3"); |
| 62 button.focus(); |
| 63 eventSender.keyDown("\r"); |
| 64 }, "clicking a button via the keyboard sends an accessible click event"); |
| 65 </script> |
| 66 |
| 67 <div id="wrapper4"> |
| 68 <button id="button4">Button</button> |
| 69 </div> |
| 70 |
| 71 <script> |
| 72 async_test(function(t) |
| 73 { |
| 74 var axButton = accessibilityController.accessibleElementById("button4"); |
| 75 axButton.addNotificationListener(function(notification) { |
| 76 if (notification == 'Clicked') { |
| 77 document.getElementById("wrapper4").style.display = "none"; |
| 78 t.done(); |
| 79 } |
| 80 }); |
| 81 |
| 82 axButton.press(); |
| 83 }, "clicking a button via accessibility sends an accessible click event"); |
| 84 </script> |
| 85 |
| 86 <div id="wrapper5"> |
| 87 <button id="button5">Button</button> |
| 88 </div> |
| 89 |
| 90 <script> |
| 91 async_test(function(t) |
| 92 { |
| 93 var axButton = accessibilityController.accessibleElementById("button5"); |
| 94 axButton.addNotificationListener(function(notification) { |
| 95 if (notification == 'Clicked') { |
| 96 assert_unreached("There shouldn't be a Clicked notification."); |
| 97 } |
| 98 }); |
| 99 |
| 100 eventSender.dragMode = true; |
| 101 eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); |
| 102 eventSender.mouseDown(); |
| 103 eventSender.leapForward(100); |
| 104 eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 100); |
| 105 eventSender.mouseUp(); |
| 106 |
| 107 // Make the test pass after a short delay. The test passes if the |
| 108 // accessible click event does not fire. |
| 109 window.setTimeout(function() { |
| 110 document.getElementById("wrapper5").style.display = "none"; |
| 111 t.done(); |
| 112 }, 200); |
| 113 }, "dragging the mouse off a button does not send an accessible click event"); |
| 114 </script> |
| 115 |
| 116 <div id="wrapper6"> |
| 117 <button id="button6">Button</button> |
| 118 </div> |
| 119 |
| 120 <script> |
| 121 async_test(function(t) |
| 122 { |
| 123 var axButton = accessibilityController.accessibleElementById("button6"); |
| 124 axButton.addNotificationListener(function(notification) { |
| 125 if (notification == 'Clicked') { |
| 126 assert_unreached("There shouldn't be a Clicked notification."); |
| 127 } |
| 128 }); |
| 129 |
| 130 eventSender.dragMode = true; |
| 131 eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 100); |
| 132 eventSender.mouseDown(); |
| 133 eventSender.leapForward(100); |
| 134 eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); |
| 135 eventSender.mouseUp(); |
| 136 |
| 137 // Make the test pass after a short delay. The test passes if the |
| 138 // accessible click event does not fire. |
| 139 window.setTimeout(function() { |
| 140 document.getElementById("wrapper6").style.display = "none"; |
| 141 t.done(); |
| 142 }, 0); |
| 143 }, "dragging the mouse onto a button does not send an accessible click event"); |
| 144 </script> |
| 145 |
| 146 <div id="wrapper7"> |
| 147 <button id="button7">Button</button> |
| 148 </div> |
| 149 |
| 150 <script> |
| 151 async_test(function(t) |
| 152 { |
| 153 var axButton = accessibilityController.accessibleElementById("button7"); |
| 154 axButton.addNotificationListener(function(notification) { |
| 155 if (notification == 'Clicked') { |
| 156 document.getElementById("wrapper7").style.display = "none"; |
| 157 t.done(); |
| 158 } |
| 159 }); |
| 160 |
| 161 eventSender.gestureTap(axButton.x + 10, axButton.y + 10); |
| 162 }, "tapping on a button with a touch event sends an accessible click event"); |
| 163 </script> |
| OLD | NEW |