accessible/tests/mochitest/test_bug420863.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/test_bug420863.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,103 @@
     1.4 +<!DOCTYPE html>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=420863
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Table indexes chrome tests</title>
    1.11 +  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.12 +
    1.13 +  <script type="application/javascript"
    1.14 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.15 +
    1.16 +  <script type="application/javascript"
    1.17 +          src="common.js"></script>
    1.18 +  <script type="application/javascript"
    1.19 +          src="events.js"></script>
    1.20 +  <script type="application/javascript"
    1.21 +          src="actions.js"></script>
    1.22 +
    1.23 +  <script type="application/javascript">
    1.24 +    var gClickHandler = null;
    1.25 +
    1.26 +    function doTest()
    1.27 +    {
    1.28 +      // Actions should be exposed on any accessible having related DOM node
    1.29 +      // with registered 'click' event handler.
    1.30 +
    1.31 +      //////////////////////////////////////////////////////////////////////////
    1.32 +      // generic td
    1.33 +      var td1Acc = getAccessible("td1");
    1.34 +      if (!td1Acc) {
    1.35 +        SimpleTest.finish();
    1.36 +        return;
    1.37 +      }
    1.38 +
    1.39 +      is(td1Acc.actionCount, 0,
    1.40 +           "Simple table cell shouldn't have any actions");
    1.41 +
    1.42 +      //////////////////////////////////////////////////////////////////////////
    1.43 +      // one td with 'onclick' attribute and one with registered click handler
    1.44 +      var td3Node = getNode("td3");
    1.45 +
    1.46 +      // register 'click' event handler
    1.47 +      gClickHandler = {
    1.48 +        handleEvent: function handleEvent(aEvent)
    1.49 +        {
    1.50 +        }
    1.51 +      };
    1.52 +      td3Node.addEventListener("click", gClickHandler, false);
    1.53 +
    1.54 +      // check actions
    1.55 +      var actionsArray = [
    1.56 +        {
    1.57 +          ID: "td2", // "onclick" attribute
    1.58 +          actionName: "click",
    1.59 +          actionIndex: 0,
    1.60 +          events: CLICK_EVENTS
    1.61 +        },
    1.62 +        {
    1.63 +          ID: td3Node,
    1.64 +          actionName: "click",
    1.65 +          actionIndex: 0,
    1.66 +          events: CLICK_EVENTS,
    1.67 +          checkOnClickEvent: function check(aEvent)
    1.68 +          {
    1.69 +            // unregister click event handler
    1.70 +            this.ID.removeEventListener("click", gClickHandler, false);
    1.71 +
    1.72 +            // check actions
    1.73 +            is(getAccessible(this.ID).actionCount, 0,
    1.74 +               "td3 shouldn't have actions");
    1.75 +          }
    1.76 +        }
    1.77 +      ];
    1.78 +
    1.79 +      testActions(actionsArray);  // will call SimpleTest.finish()
    1.80 +    }
    1.81 +
    1.82 +    SimpleTest.waitForExplicitFinish();
    1.83 +    addA11yLoadEvent(doTest);
    1.84 +  </script>
    1.85 +</head>
    1.86 +<body>
    1.87 +
    1.88 +  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=420863"
    1.89 +     title="If an HTML element has an onClick attribute, expose its click action on the element rather than its child text leaf node."
    1.90 +     target="_blank">Mozilla Bug 420863</a>
    1.91 +  <p id="display"></p>
    1.92 +  <div id="content" style="display: none"></div>
    1.93 +  <pre id="test">
    1.94 +  </pre>
    1.95 +
    1.96 +  <table>
    1.97 +    <tr>
    1.98 +      <td id="td1">Can't click this cell</td>
    1.99 +      <td onclick="gTdClickAttr = true;"
   1.100 +          id="td2">Cell with 'onclick' attribute</td>
   1.101 +      <td id="td3">Cell with registered 'click' event handler</td>
   1.102 +    </tr>
   1.103 +  </table>
   1.104 +
   1.105 +</body>
   1.106 +</html>

mercurial