Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 <!DOCTYPE html>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=420863
5 -->
6 <head>
7 <title>Table indexes chrome tests</title>
8 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
10 <script type="application/javascript"
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
13 <script type="application/javascript"
14 src="common.js"></script>
15 <script type="application/javascript"
16 src="events.js"></script>
17 <script type="application/javascript"
18 src="actions.js"></script>
20 <script type="application/javascript">
21 var gClickHandler = null;
23 function doTest()
24 {
25 // Actions should be exposed on any accessible having related DOM node
26 // with registered 'click' event handler.
28 //////////////////////////////////////////////////////////////////////////
29 // generic td
30 var td1Acc = getAccessible("td1");
31 if (!td1Acc) {
32 SimpleTest.finish();
33 return;
34 }
36 is(td1Acc.actionCount, 0,
37 "Simple table cell shouldn't have any actions");
39 //////////////////////////////////////////////////////////////////////////
40 // one td with 'onclick' attribute and one with registered click handler
41 var td3Node = getNode("td3");
43 // register 'click' event handler
44 gClickHandler = {
45 handleEvent: function handleEvent(aEvent)
46 {
47 }
48 };
49 td3Node.addEventListener("click", gClickHandler, false);
51 // check actions
52 var actionsArray = [
53 {
54 ID: "td2", // "onclick" attribute
55 actionName: "click",
56 actionIndex: 0,
57 events: CLICK_EVENTS
58 },
59 {
60 ID: td3Node,
61 actionName: "click",
62 actionIndex: 0,
63 events: CLICK_EVENTS,
64 checkOnClickEvent: function check(aEvent)
65 {
66 // unregister click event handler
67 this.ID.removeEventListener("click", gClickHandler, false);
69 // check actions
70 is(getAccessible(this.ID).actionCount, 0,
71 "td3 shouldn't have actions");
72 }
73 }
74 ];
76 testActions(actionsArray); // will call SimpleTest.finish()
77 }
79 SimpleTest.waitForExplicitFinish();
80 addA11yLoadEvent(doTest);
81 </script>
82 </head>
83 <body>
85 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=420863"
86 title="If an HTML element has an onClick attribute, expose its click action on the element rather than its child text leaf node."
87 target="_blank">Mozilla Bug 420863</a>
88 <p id="display"></p>
89 <div id="content" style="display: none"></div>
90 <pre id="test">
91 </pre>
93 <table>
94 <tr>
95 <td id="td1">Can't click this cell</td>
96 <td onclick="gTdClickAttr = true;"
97 id="td2">Cell with 'onclick' attribute</td>
98 <td id="td3">Cell with registered 'click' event handler</td>
99 </tr>
100 </table>
102 </body>
103 </html>