summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/accessibility/aria-checkbox-checked.html
blob: 61d496c083f87dc0d468869c1acac81b8d83f844 (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
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">

<input type="checkbox" id="check1" />
<input type="checkbox" id="check2" checked />

<div tabindex="0" role="checkbox" id="check3">X</div>
<div tabindex="0" role="checkbox" id="check4" aria-checked="true">X</div>

<input type="checkbox" id="check5" aria-checked="false" />
<input type="checkbox" id="check6" aria-checked="false" checked />
<input type="checkbox" id="check7" aria-checked="true" />
<input type="checkbox" id="check8" aria-checked="true" checked />

<p id="description"></p>
<div id="console"></div>

<script>

    description("This tests that ARIA checkboxes correctly handle the aria-checked attribute.");

    if (window.accessibilityController) {

          var answers = [[ "check1", "false" ],
                         [ "check2", "true" ],
                         [ "check3", "false" ],
                         [ "check4", "true" ],
                         [ "check5", "false" ],
                         [ "check6", "true" ],
                         [ "check7", "false" ],
                         [ "check8", "true" ]];

          for (var i = 0; i < answers.length; i++) {
                var checkbox = document.getElementById(answers[i][0]);
                checkbox.focus();
                checkbox = accessibilityController.focusedElement;
                shouldBe("checkbox.isChecked", answers[i][1]);
          }
    }

</script>

<script src="../fast/js/resources/js-test-post.js"></script>
</body>
</html>