5bc725c29e18066ea99b28eba6b9d9d685124694
[WebKit-https.git] / LayoutTests / accessibility / aria-readonly.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script>
5 var successfullyParsed = false;
6 </script>
7 <script src="../fast/js/resources/js-test-pre.js"></script>
8 </head>
9 <body id="body">
10 <div role="textbox" aria-readonly="false" aria-multiline="false" id="ariaTextBox" tabindex="0"></div>
11 <div role="textbox" aria-readonly="true" id="ariaReadOnlyAriaTextBox" tabindex="0"></div>
12 <input type="text" aria-readonly="true" id="ariaReadOnlyTextField" size=20>
13 <input type="text" aria-readonly="false" id="ariaNonReadOnlyTextField" size=20>
14 <input type="text" readonly="readonly" id="htmlReadOnlyTextField" size=20>
15 <input type="text" id="textField" size=20>
16 <textarea rows="2" cols="20" readonly="readonly" id="htmlReadOnlyTextArea"></textarea>
17 <textarea rows="2" cols="20" id="textArea"></textarea>
18 <p id="description"></p>
19 <div id="console"></div>
20
21 <script>
22
23     description("This tests that the AXValue property is correctly reported for native and non-native text boxes.");
24
25     if (window.accessibilityController) {
26           document.getElementById("ariaTextBox").focus();
27           var ariaTextBox = accessibilityController.focusedElement;
28           var ariaTextBoxIsWritable = ariaTextBox.isAttributeSettable("AXValue");
29           shouldBe("ariaTextBoxIsWritable", "true");
30
31           document.getElementById("ariaReadOnlyAriaTextBox").focus();
32           var ariaReadOnlyAriaTextBox = accessibilityController.focusedElement;
33           var ariaReadOnlyAriaTextBoxIsWritable = ariaReadOnlyAriaTextBox.isAttributeSettable("AXValue");
34           shouldBe("ariaReadOnlyAriaTextBoxIsWritable", "false");
35
36           document.getElementById("ariaReadOnlyTextField").focus();
37           var ariaReadOnlyTextField = accessibilityController.focusedElement;
38           var ariaReadOnlyTextFieldIsWritable = ariaReadOnlyTextField.isAttributeSettable("AXValue");
39           shouldBe("ariaReadOnlyTextFieldIsWritable", "false");
40
41           document.getElementById("ariaNonReadOnlyTextField").focus();
42           var ariaNonReadOnlyTextField = accessibilityController.focusedElement;
43           var ariaNonReadOnlyTextFieldIsWritable = ariaNonReadOnlyTextField.isAttributeSettable("AXValue");
44           shouldBe("ariaNonReadOnlyTextFieldIsWritable", "true");
45
46           document.getElementById("htmlReadOnlyTextField").focus();
47           var htmlReadOnlyTextField = accessibilityController.focusedElement;
48           var htmlReadOnlyTextFieldIsWritable = htmlReadOnlyTextField.isAttributeSettable("AXValue");
49           shouldBe("htmlReadOnlyTextFieldIsWritable", "false");
50
51           document.getElementById("textField").focus();
52           var textField = accessibilityController.focusedElement;
53           var textFieldIsWritable = textField.isAttributeSettable("AXValue");
54           shouldBe("textFieldIsWritable", "true");
55
56           document.getElementById("htmlReadOnlyTextArea").focus();
57           var htmlReadOnlyTextArea = accessibilityController.focusedElement;
58           var htmlReadOnlyTextAreaIsWritable = htmlReadOnlyTextArea.isAttributeSettable("AXValue");
59           shouldBe("htmlReadOnlyTextAreaIsWritable", "false");
60
61           document.getElementById("textArea").focus();
62           var textArea = accessibilityController.focusedElement;
63           var textAreaIsWritable = textArea.isAttributeSettable("AXValue");
64           shouldBe("textAreaIsWritable", "true");
65     }
66
67     successfullyParsed = true;
68 </script>
69
70 <script src="../fast/js/resources/js-test-post.js"></script>
71 </body>
72 </html>