summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/jsat/test_hints.html
blob: d5691b97a26a3864899cc3bd84f21d5ca87ca2ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<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>