summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/actions/test_anchors.html
blob: 6ee1e0c4503b2277a9eaf1f074212cdbda1d6d43 (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<html>

<head>
  <title>nsIAccessible actions testing for HTML links that
   scroll the page to named anchors</title>

  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../events.js"></script>
  <script type="application/javascript"
          src="../actions.js"></script>

  <script type="application/javascript">
    // //////////////////////////////////////////////////////////////////////////
    // Event checkers

    function scrollingChecker(aAcc) {
      this.type = EVENT_SCROLLING_START;
      this.target = aAcc;
      this.getID = function scrollingChecker_getID() {
        return "scrolling start handling for " + prettyName(aAcc);
      };
    }

    // //////////////////////////////////////////////////////////////////////////
    // Test

    // gA11yEventDumpID = "debug"; // debug stuff
    // gA11yEventDumpToConsole = true; // debug stuff

    function doTest() {
      var actionsArray = [
        {
          ID: "anchor1",
          actionName: "jump",
          actionIndex: 0,
          events: CLICK_EVENTS,
          eventSeq: [
            new scrollingChecker(getAccessible("bottom1")),
          ],
        },
        { // jump again (test for bug 437607)
          ID: "anchor1",
          actionName: "jump",
          actionIndex: 0,
          events: CLICK_EVENTS,
          eventSeq: [
            new scrollingChecker(getAccessible("bottom1")),
          ],
        },
        {
          ID: "anchor2",
          actionName: "jump",
          actionIndex: 0,
          events: CLICK_EVENTS,
          eventSeq: [
            new scrollingChecker(getAccessible("bottom2")),
          ],
        },
      ];

      testActions(actionsArray);
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>

<body>

  <a target="_blank" rel="opener"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=506389"
     title="Some same page links do not fire EVENT_SYSTEM_SCROLLINGSTART">
    Mozilla Bug 506389
  </a><br>
  <a target="_blank" rel="opener"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=437607"
     title="Clicking the 'Skip to main content' link once works, second time fails to initiate a V cursor jump">
    Mozilla Bug 437607
  </a><br>
  <a target="_blank" rel="opener"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=519303"
     title="Same page links to targets with content fires scrolling start accessible event on leaf text node">
    Mozilla Bug 519303
  </a>

  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <div id="debug"></div>

  <h1>This is a test page for anchors</h1>
  This is a top anchor<a name="Top">
  </a><a id="anchor1" href="#bottom1">Link to anchor</a>
  <a id="anchor2" href="#bottom2">Link to div</a>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br>This is some text in the middle<br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  This is some text.
  This is a bottom anchor<a id="bottom1"></a>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <br><br><br><br><br><br><br><br><br><br>
  <div id="bottom2">This is a div</div>
</body>
</html>