Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | |
michael@0 | 4 | <head> |
michael@0 | 5 | <title>HTML text controls tests</title> |
michael@0 | 6 | <link rel="stylesheet" type="text/css" |
michael@0 | 7 | href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
michael@0 | 8 | |
michael@0 | 9 | <script type="application/javascript" |
michael@0 | 10 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="../common.js"></script> |
michael@0 | 14 | <script type="application/javascript" |
michael@0 | 15 | src="../role.js"></script> |
michael@0 | 16 | |
michael@0 | 17 | <script type="application/javascript"> |
michael@0 | 18 | function doTest() |
michael@0 | 19 | { |
michael@0 | 20 | // editable div |
michael@0 | 21 | var accTree = { |
michael@0 | 22 | role: ROLE_SECTION, |
michael@0 | 23 | children: [ |
michael@0 | 24 | { // text child |
michael@0 | 25 | role: ROLE_TEXT_LEAF, |
michael@0 | 26 | children: [] |
michael@0 | 27 | } |
michael@0 | 28 | ] |
michael@0 | 29 | }; |
michael@0 | 30 | |
michael@0 | 31 | testAccessibleTree("txc1", accTree); |
michael@0 | 32 | |
michael@0 | 33 | // input@type="text", value |
michael@0 | 34 | accTree = { |
michael@0 | 35 | role: ROLE_ENTRY, |
michael@0 | 36 | children: [ |
michael@0 | 37 | { // text child |
michael@0 | 38 | role: ROLE_TEXT_LEAF, |
michael@0 | 39 | children: [] |
michael@0 | 40 | } |
michael@0 | 41 | ] |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | testAccessibleTree("txc2", accTree); |
michael@0 | 45 | |
michael@0 | 46 | // input@type="text", no value |
michael@0 | 47 | accTree = |
michael@0 | 48 | { ENTRY: [ ] }; |
michael@0 | 49 | |
michael@0 | 50 | testAccessibleTree("txc3", accTree); |
michael@0 | 51 | |
michael@0 | 52 | // textarea |
michael@0 | 53 | accTree = { |
michael@0 | 54 | role: ROLE_ENTRY, |
michael@0 | 55 | children: [ |
michael@0 | 56 | { |
michael@0 | 57 | role: ROLE_TEXT_LEAF // hello1\nhello2 text |
michael@0 | 58 | } |
michael@0 | 59 | ] |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | testAccessibleTree("txc4", accTree); |
michael@0 | 63 | |
michael@0 | 64 | // input@type="password" |
michael@0 | 65 | accTree = { |
michael@0 | 66 | role: ROLE_PASSWORD_TEXT, |
michael@0 | 67 | children: [ |
michael@0 | 68 | { |
michael@0 | 69 | role: ROLE_TEXT_LEAF, |
michael@0 | 70 | children: [] |
michael@0 | 71 | } |
michael@0 | 72 | ] |
michael@0 | 73 | }; |
michael@0 | 74 | |
michael@0 | 75 | testAccessibleTree("txc5", accTree); |
michael@0 | 76 | |
michael@0 | 77 | // input@type="tel", value |
michael@0 | 78 | accTree = { |
michael@0 | 79 | role: ROLE_ENTRY, |
michael@0 | 80 | children: [ |
michael@0 | 81 | { // text child |
michael@0 | 82 | role: ROLE_TEXT_LEAF, |
michael@0 | 83 | children: [] |
michael@0 | 84 | } |
michael@0 | 85 | ] |
michael@0 | 86 | }; |
michael@0 | 87 | |
michael@0 | 88 | testAccessibleTree("txc6", accTree); |
michael@0 | 89 | |
michael@0 | 90 | // input@type="email", value |
michael@0 | 91 | accTree = { |
michael@0 | 92 | role: ROLE_ENTRY, |
michael@0 | 93 | children: [ |
michael@0 | 94 | { // text child |
michael@0 | 95 | role: ROLE_TEXT_LEAF, |
michael@0 | 96 | children: [] |
michael@0 | 97 | } |
michael@0 | 98 | ] |
michael@0 | 99 | }; |
michael@0 | 100 | |
michael@0 | 101 | testAccessibleTree("txc7", accTree); |
michael@0 | 102 | |
michael@0 | 103 | // input@type="search", value |
michael@0 | 104 | accTree = { |
michael@0 | 105 | role: ROLE_ENTRY, |
michael@0 | 106 | children: [ |
michael@0 | 107 | { // text child |
michael@0 | 108 | role: ROLE_TEXT_LEAF, |
michael@0 | 109 | children: [] |
michael@0 | 110 | } |
michael@0 | 111 | ] |
michael@0 | 112 | }; |
michael@0 | 113 | |
michael@0 | 114 | testAccessibleTree("txc8", accTree); |
michael@0 | 115 | |
michael@0 | 116 | SimpleTest.finish(); |
michael@0 | 117 | } |
michael@0 | 118 | |
michael@0 | 119 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 120 | addA11yLoadEvent(doTest); |
michael@0 | 121 | </script> |
michael@0 | 122 | </head> |
michael@0 | 123 | <body> |
michael@0 | 124 | |
michael@0 | 125 | <a target="_blank" |
michael@0 | 126 | title="overflowed content doesn't expose child text accessibles" |
michael@0 | 127 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=489306"> |
michael@0 | 128 | Mozilla Bug 489306 |
michael@0 | 129 | </a><br> |
michael@0 | 130 | <a target="_blank" |
michael@0 | 131 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=542824" |
michael@0 | 132 | title="Create child accessibles for text controls from native anonymous content"> |
michael@0 | 133 | Mozilla Bug 542824 |
michael@0 | 134 | </a> |
michael@0 | 135 | <a target="_blank" |
michael@0 | 136 | href="https://bugzilla.mozilla.org/show_bug.cgi?id=625652" |
michael@0 | 137 | title="Make sure accessible tree is correct when rendered text is changed"> |
michael@0 | 138 | Mozilla Bug 625652 |
michael@0 | 139 | </a> |
michael@0 | 140 | |
michael@0 | 141 | <p id="display"></p> |
michael@0 | 142 | <div id="content" style="display: none"></div> |
michael@0 | 143 | <pre id="test"> |
michael@0 | 144 | </pre> |
michael@0 | 145 | |
michael@0 | 146 | <div id="txc1" contentEditable="true"> |
michael@0 | 147 | 1hellohello |
michael@0 | 148 | </div> |
michael@0 | 149 | <input id="txc2" value="hello"> |
michael@0 | 150 | <input id="txc3"> |
michael@0 | 151 | <textarea id="txc4"> |
michael@0 | 152 | hello1 |
michael@0 | 153 | hello2 |
michael@0 | 154 | </textarea> |
michael@0 | 155 | <input id="txc5" type="password" value="hello"> |
michael@0 | 156 | <input id="txc6" type="tel" value="4167771234"> |
michael@0 | 157 | |
michael@0 | 158 | Email Address: |
michael@0 | 159 | <input id="txc7" type="email" list="contacts" value="xyzzy"> |
michael@0 | 160 | <datalist id="contacts"> |
michael@0 | 161 | <option>xyzzy@plughs.com</option> |
michael@0 | 162 | <option>nobody@mozilla.org</option> |
michael@0 | 163 | </datalist> |
michael@0 | 164 | |
michael@0 | 165 | </br>Search for: |
michael@0 | 166 | <input id="txc8" type="search" list="searchhisty" value="Gamma"> |
michael@0 | 167 | <datalist id="searchhisty"> |
michael@0 | 168 | <option>Gamma Rays</option> |
michael@0 | 169 | <option>Gamma Ray Bursts</option> |
michael@0 | 170 | </datalist> |
michael@0 | 171 | |
michael@0 | 172 | </body> |
michael@0 | 173 | </html> |