accessible/tests/mochitest/jsat/test_hints.html
author Mark Banner <standard8@mozilla.com>
Fri, 19 Oct 2018 12:55:39 +0000
changeset 490493 edc4ae8f78e2fb02647d7cd85cb19830a17dcd1d
parent 414421 2439d45c93be640c6cf4c1005a4302ee75aa3cee
permissions -rw-r--r--
Bug 1486741 - Enable ESLint rule comma-dangle for all of mozilla-central (automatic fixes). r=mossop Differential Revision: https://phabricator.services.mozilla.com/D8389

<html>
<head>
  <title> [AccessFu] Interaction Hints </title>

  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
  <script type="application/javascript"
          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="output.js"></script>
  <script type="application/javascript">

    function doTest() {
      var tests = [{
        accOrElmOrID: "can_wheel",
        expectedHints: ["Swipe with two fingers to move between pages"],
      }, {
        accOrElmOrID: "nested_link",
        expectedHints: [{string: "link-hint"},
          "Swipe with two fingers to move between pages"],
      }, {
        accOrElmOrID: "nested_link",
        oldAccOrElmOrID: "can_wheel",
        expectedHints: [{string: "link-hint"}],
      }, {
        accOrElmOrID: "link_with_default_hint",
        expectedHints: [{string: "link-hint"}],
      }, {
        accOrElmOrID: "link_with_hint_override",
        expectedHints: ["Tap and hold to get to menu"],
      }, {
        accOrElmOrID: "button_with_default_hint",
        expectedHints: [{string: "pushbutton-hint"}],
      }, {
        accOrElmOrID: "button_with_hint_override",
        expectedHints: ["Tap and hold to activate"],
      }, {
        accOrElmOrID: "nested_link2",
        expectedHints: [{string: "link-hint"}],
      }, {
        accOrElmOrID: "nested_link3",
        expectedHints: [{string: "link-hint"}, {string: "pushbutton-hint"},
          "Double tap and hold to activate"],
      }, {
        accOrElmOrID: "menuitemradio",
        expectedHints: [{string: "radiomenuitem-hint"}],
      }];

      // Test hints.
      tests.forEach(function run(test) {
        testHints(test.expectedHints, test.accOrElmOrID, test.oldAccOrElmOrID);
      });

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>
<body>
  <div id="root">
    <a target="_blank"
       href="https://bugzilla.mozilla.org/show_bug.cgi?id=1069574"
       title="[AccessFu] Interaction Hints">
       Mozilla Bug 1069574
       </a>
    <p id="display"></p>
    <div id="content" style="display: none"></div>
    <pre id="test"></pre>
      <span role="region" id="can_wheel" aria-moz-hint="Swipe with two fingers to move between pages">
        <a href="#" id="nested_link">I can be clicked</a>
      </span>
      <span role="region" aria-moz-hint="">
        <a><a href="#" id="nested_link2">I can be clicked</a></a>
      </span>
      <span role="region" aria-moz-hint="Double tap and hold to activate">
        <button><a href="#" id="nested_link3">I can be clicked</a></button>
      </span>
      <a href="#" id="link_with_default_hint">I can be clicked</a>
      <a href="#" id="link_with_hint_override" aria-moz-hint="Tap and hold to get to menu">I am a special link</a>
      <button id="button_with_default_hint">Toggle</button>
      <button id="button_with_hint_override" aria-moz-hint="Tap and hold to activate">Special</button>
      <span id="menuitemradio" role="menuitemradio">Item 1</span>
  </div>
</body>
</html>