blob: f7aac3e98d2c103d4c8a55db20b7856f467442fc (
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
|
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
<body>
<p id="description"></p>
<div id="console"></div>
<input type="radio" name="r1" id="r1" title="TITLE">Test<br>
<label for="r1">LABEL</label>
<input type="radio" id="r2" aria-labeledby="label3">Test<br>
<label for="r2">LABEL2</label>
<div id="label3">LABEL2a</div>
<input type="radio" name="r3" id="r3" aria-label="radio3">Test<br>
<label for="r3">LABEL3</label>
<script>
description("This test checks that radio buttons expose title ui elements correctly under a variety of cirmcumstances. In general, the <label> should disappear and act as the title for the radio button.");
if (window.accessibilityController) {
// radio button 1
document.getElementById("r1").focus();
// 1) Even though a checkbox has a title attribute, the title ui element should still be exposed.
var focusedElement = accessibilityController.focusedElement;
var titleUIElement = focusedElement.titleUIElement();
shouldBe("focusedElement.title", "'AXTitle: LABEL'");
shouldBeTrue("!titleUIElement || titleUIElement.title == 'AXTitle: '");
// 2) aria-labeledby should override the native label semantics and return a title for the radio button, instead of a title ui element.
document.getElementById("r2").focus();
focusedElement = accessibilityController.focusedElement;
titleUIElement = focusedElement.titleUIElement();
shouldBe("focusedElement.description", "'AXDescription: LABEL2a'");
shouldBe("focusedElement.title", "'AXTitle: '");
shouldBeTrue("!titleUIElement || titleUIElement.title == 'AXTitle: '");
// 3) If a radio button has an aria-label and a <label>, the aria-label should be the title.
document.getElementById("r3").focus();
focusedElement = accessibilityController.focusedElement;
titleUIElement = focusedElement.titleUIElement();
shouldBe("focusedElement.description", "'AXDescription: radio3'");
shouldBe("focusedElement.title", "'AXTitle: '");
shouldBeTrue("!titleUIElement || titleUIElement.title == 'AXTitle: '");
}
</script>
<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
|