Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: third_party/WebKit/LayoutTests/accessibility/radio-button-title-label.html

Issue 1417213006: Switch all LayoutTests to use new AX name calculation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix canvas-fallback-content-labels-expected.txt Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../resources/js-test.js"></script> 3 <script src="../resources/js-test.js"></script>
4 </head> 4 </head>
5 <script> 5 <script>
6 if (window.testRunner) 6 if (window.testRunner)
7 testRunner.dumpAsText(); 7 testRunner.dumpAsText();
8 </script> 8 </script>
9 <body> 9 <body>
10 10
11 <p id="description"></p> 11 <p id="description"></p>
12 <div id="console"></div> 12 <div id="console"></div>
13 13
14 <input type="radio" name="r1" id="r1" title="TITLE">Test<br> 14 <input type="radio" name="r1" id="r1" title="TITLE">Test<br>
15 <label for="r1">LABEL</label> 15 <label for="r1">LABEL</label>
16 16
17 <input type="radio" id="r2" aria-labeledby="label3">Test<br> 17 <input type="radio" id="r2" aria-labeledby="label3">Test<br>
18 <label for="r2">LABEL2</label> 18 <label for="r2">LABEL2</label>
19 <div id="label3">LABEL2a</div> 19 <div id="label3">LABEL2a</div>
20 20
21 <input type="radio" name="r3" id="r3" aria-label="radio3">Test<br> 21 <input type="radio" name="r3" id="r3" aria-label="radio3">Test<br>
22 <label for="r3">LABEL3</label> 22 <label for="r3">LABEL3</label>
23 23
24 <script> 24 <script>
25 25
26 description("This test checks that radio buttons expose title ui element s correctly under a variety of cirmcumstances. In general, the <label> should di sappear and act as the title for the radio button."); 26 description("This test checks that radio buttons expose title ui element s correctly under a variety of cirmcumstances. In general, the <label> should di sappear and act as the title for the radio button.");
27 27
28 if (window.accessibilityController) { 28 if (window.accessibilityController) {
29 29
30 // radio button 1 30 // radio button 1
31 document.getElementById("r1").focus(); 31 document.getElementById("r1").focus();
32 32
33 // 1) Even though a checkbox has a title attribute, the title ui ele ment should still be exposed. 33 // 1) Even though a checkbox has a title attribute, the title ui ele ment should still be exposed.
34 var focusedElement = accessibilityController.focusedElement; 34 var focusedElement = accessibilityController.focusedElement;
35 var titleUIElement = focusedElement.deprecatedTitleUIElement(); 35 var titleUIElement = focusedElement.nameElementAtIndex(0);
36 shouldBe("focusedElement.deprecatedTitle", "'AXTitle: LABEL'"); 36 shouldBe("focusedElement.name", "'LABEL'");
37 shouldBeTrue("!titleUIElement || titleUIElement.deprecatedTitle == ' AXTitle: '"); 37 shouldBeTrue("!titleUIElement || titleUIElement.name == ''");
38 38
39 // 2) aria-labeledby should override the native label semantics and return a title for the radio button, instead of a title ui element. 39 // 2) aria-labeledby should override the native label semantics and return a title for the radio button, instead of a title ui element.
40 document.getElementById("r2").focus(); 40 document.getElementById("r2").focus();
41 focusedElement = accessibilityController.focusedElement; 41 focusedElement = accessibilityController.focusedElement;
42 titleUIElement = focusedElement.deprecatedTitleUIElement(); 42 titleUIElement = focusedElement.nameElementAtIndex(0);
43 shouldBe("focusedElement.deprecatedDescription", "'AXDescription: LA BEL2a'"); 43 shouldBe("focusedElement.name", "'LABEL2a'");
44 shouldBe("focusedElement.deprecatedTitle", "'AXTitle: '"); 44 shouldBe("focusedElement.description", "''");
45 shouldBeTrue("!titleUIElement || titleUIElement.deprecatedTitle == ' AXTitle: '"); 45 shouldBeTrue("!titleUIElement || titleUIElement.name == ''");
46 46
47 // 3) If a radio button has an aria-label and a <label>, the aria-la bel should be the title. 47 // 3) If a radio button has an aria-label and a <label>, the aria-la bel should be the title.
48 document.getElementById("r3").focus(); 48 document.getElementById("r3").focus();
49 focusedElement = accessibilityController.focusedElement; 49 focusedElement = accessibilityController.focusedElement;
50 titleUIElement = focusedElement.deprecatedTitleUIElement(); 50 titleUIElement = focusedElement.nameElementAtIndex(0);
51 shouldBe("focusedElement.deprecatedDescription", "'AXDescription: ra dio3'"); 51 shouldBe("focusedElement.name", "'radio3'");
52 shouldBe("focusedElement.deprecatedTitle", "'AXTitle: '"); 52 shouldBe("focusedElement.description", "''");
53 shouldBeTrue("!titleUIElement || titleUIElement.deprecatedTitle == ' AXTitle: '"); 53 shouldBeTrue("!titleUIElement || titleUIElement.name == ''");
54 54
55 } 55 }
56 </script> 56 </script>
57 57
58 58
59 </body> 59 </body>
60 </html> 60 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698