summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/tree/test_txtctrl.html
blob: ee66fbf8014b59c41e1ec2606b3cbce18676de49 (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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html>

<head>
  <title>HTML text controls tests</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="../role.js"></script>

  <script type="application/javascript">
    function doTest() {
      // editable div
      var accTree = {
        role: ROLE_SECTION,
        children: [
          { // text child
            role: ROLE_TEXT_LEAF,
            children: [],
          },
        ],
      };

      testAccessibleTree("txc1", accTree);

      // input@type="text", value
      accTree = {
        role: ROLE_ENTRY,
        children: [
          { // text child
            role: ROLE_TEXT_LEAF,
            children: [],
          },
        ],
      };

      testAccessibleTree("txc2", accTree);

      // input@type="text", no value
      accTree =
        { ENTRY: [ ] };

      testAccessibleTree("txc3", accTree);

      // textarea
      accTree = {
        role: ROLE_ENTRY,
        children: [
          {
            role: ROLE_TEXT_LEAF, // hello1\nhello2 text
          },
        ],
      };

      testAccessibleTree("txc4", accTree);

      // input@type="password"
      accTree = {
        role: ROLE_PASSWORD_TEXT,
        children: [
          {
            role: ROLE_TEXT_LEAF,
            children: [],
          },
        ],
      };

      testAccessibleTree("txc5", accTree);
    
      // input@type="tel", value
      accTree = {
        role: ROLE_ENTRY,
        children: [
          { // text child
            role: ROLE_TEXT_LEAF,
            children: [],
          },
        ],
      };

      testAccessibleTree("txc6", accTree);

      // input@type="email", value
      accTree = {
        role: ROLE_EDITCOMBOBOX, // Because of list attribute
        children: [
          { // text child
            role: ROLE_TEXT_LEAF,
            children: [],
          },
        ],
      };

      testAccessibleTree("txc7", accTree);

      // input@type="search", value
      accTree = {
        role: ROLE_EDITCOMBOBOX, // Because of list attribute
        children: [
          { // text child
            role: ROLE_TEXT_LEAF,
            children: [],
          },
        ],
      };

      testAccessibleTree("txc8", accTree);

      SimpleTest.finish();
    }

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

  <a target="_blank"
     title="overflowed content doesn't expose child text accessibles"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=489306">
    Mozilla Bug 489306
  </a><br>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=542824"
     title="Create child accessibles for text controls from native anonymous content">
    Mozilla Bug 542824
  </a>
  <a target="_blank"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=625652"
     title="Make sure accessible tree is correct when rendered text is changed">
    Mozilla Bug 625652
  </a>

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

  <div id="txc1" contentEditable="true">
    1hellohello
  </div>
  <input id="txc2" value="hello">
  <input id="txc3">
  <textarea id="txc4">
    hello1
    hello2
  </textarea>
  <input id="txc5" type="password" value="hello">
  <input id="txc6" type="tel" value="4167771234">

  Email Address:
  <input id="txc7" type="email" list="contacts" value="xyzzy">
  <datalist id="contacts">
    <option>xyzzy@plughs.com</option>
    <option>nobody@mozilla.org</option>
  </datalist>

  </br>Search for:
  <input id="txc8" type="search" list="searchhisty" value="Gamma">
  <datalist id="searchhisty">
    <option>Gamma Rays</option>
    <option>Gamma Ray Bursts</option>
  </datalist>

</body>
</html>