| <!DOCTYPE HTML> | |
| <script src="../resources/testharness.js"></script> | |
| <script src="../resources/testharnessreport.js"></script> | |
| <div id="wrapper1"> | |
| <button id="button1">Button</button> | |
| </div> | |
| <script> | |
| async_test(function(t) | |
| { | |
| var axButton = accessibilityController.accessibleElementById("button1"); | |
| axButton.addNotificationListener(function(notification) { | |
| if (notification == 'Clicked') { | |
| document.getElementById("wrapper1").style.display = "none"; | |
| t.done(); | |
| } | |
| }); | |
| var button = document.getElementById("button1"); | |
| button.click(); | |
| }, "clicking a button via javascript sends an accessible click event"); | |
| </script> | |
| <div id="wrapper2"> | |
| <button id="button2">Button</button> | |
| </div> | |
| <script> | |
| async_test(function(t) | |
| { | |
| var axButton = accessibilityController.accessibleElementById("button2"); | |
| axButton.addNotificationListener(function(notification) { | |
| if (notification == 'Clicked') { | |
| document.getElementById("wrapper2").style.display = "none"; | |
| t.done(); | |
| } | |
| }); | |
| eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); | |
| eventSender.mouseDown(); | |
| eventSender.mouseUp(); | |
| }, "clicking a button via mouse events sends an accessible click event"); | |
| </script> | |
| <div id="wrapper3"> | |
| <button id="button3">Button</button> | |
| </div> | |
| <script> | |
| async_test(function(t) | |
| { | |
| var axButton = accessibilityController.accessibleElementById("button3"); | |
| axButton.addNotificationListener(function(notification) { | |
| if (notification == 'Clicked') { | |
| document.getElementById("wrapper3").style.display = "none"; | |
| t.done(); | |
| } | |
| }); | |
| var button = document.getElementById("button3"); | |
| button.focus(); | |
| eventSender.keyDown("\r"); | |
| }, "clicking a button via the keyboard sends an accessible click event"); | |
| </script> | |
| <div id="wrapper4"> | |
| <button id="button4">Button</button> | |
| </div> | |
| <script> | |
| async_test(function(t) | |
| { | |
| var axButton = accessibilityController.accessibleElementById("button4"); | |
| axButton.addNotificationListener(function(notification) { | |
| if (notification == 'Clicked') { | |
| document.getElementById("wrapper4").style.display = "none"; | |
| t.done(); | |
| } | |
| }); | |
| axButton.press(); | |
| }, "clicking a button via accessibility sends an accessible click event"); | |
| </script> | |
| <div id="wrapper5"> | |
| <button id="button5">Button</button> | |
| </div> | |
| <script> | |
| async_test(function(t) | |
| { | |
| var axButton = accessibilityController.accessibleElementById("button5"); | |
| axButton.addNotificationListener(function(notification) { | |
| if (notification == 'Clicked') { | |
| assert_unreached("There shouldn't be a Clicked notification."); | |
| } | |
| }); | |
| eventSender.dragMode = true; | |
| eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); | |
| eventSender.mouseDown(); | |
| eventSender.leapForward(100); | |
| eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 100); | |
| eventSender.mouseUp(); | |
| // Make the test pass after a short delay. The test passes if the | |
| // accessible click event does not fire. | |
| window.setTimeout(function() { | |
| document.getElementById("wrapper5").style.display = "none"; | |
| t.done(); | |
| }, 200); | |
| }, "dragging the mouse off a button does not send an accessible click event"); | |
| </script> | |
| <div id="wrapper6"> | |
| <button id="button6">Button</button> | |
| </div> | |
| <script> | |
| async_test(function(t) | |
| { | |
| var axButton = accessibilityController.accessibleElementById("button6"); | |
| axButton.addNotificationListener(function(notification) { | |
| if (notification == 'Clicked') { | |
| assert_unreached("There shouldn't be a Clicked notification."); | |
| } | |
| }); | |
| eventSender.dragMode = true; | |
| eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 100); | |
| eventSender.mouseDown(); | |
| eventSender.leapForward(100); | |
| eventSender.mouseMoveTo(axButton.x + 10, axButton.y + 10); | |
| eventSender.mouseUp(); | |
| // Make the test pass after a short delay. The test passes if the | |
| // accessible click event does not fire. | |
| window.setTimeout(function() { | |
| document.getElementById("wrapper6").style.display = "none"; | |
| t.done(); | |
| }, 0); | |
| }, "dragging the mouse onto a button does not send an accessible click event"); | |
| </script> | |
| <div id="wrapper7"> | |
| <button id="button7">Button</button> | |
| </div> | |
| <script> | |
| async_test(function(t) | |
| { | |
| var axButton = accessibilityController.accessibleElementById("button7"); | |
| axButton.addNotificationListener(function(notification) { | |
| if (notification == 'Clicked') { | |
| document.getElementById("wrapper7").style.display = "none"; | |
| t.done(); | |
| } | |
| }); | |
| eventSender.gestureTap(axButton.x + 10, axButton.y + 10); | |
| }, "tapping on a button with a touch event sends an accessible click event"); | |
| </script> |