blob: e0f5b095bd6af95b919205f2ecb2dca306462cbf [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<body>
<script src="../resources/js-test-pre.js"></script>
<div>
<input id="text1" type="text" value="Value">
<input id="checkbox1" type="checkbox" checked>
<input id="number1" type="number" value="123">
<input id="radio1" type="radio" checked>
<input id="slider1" type="range" min="1" max="10" value="5">
<input id="submit1" type="submit">
<select id="combobox1"><option>1<option selected>2</select>
<select multiple id="listbox1"><option>1<option selected>2</select>
<textarea id="textarea1">Textarea</textarea>
</div>
<div contentEditable>
<input id="text2" type="text" value="Value">
<input id="checkbox2" type="checkbox" checked>
<input id="number2" type="number" value="123">
<input id="radio2" type="radio" checked>
<input id="slider2" type="range" min="1" max="10" value="5">
<input id="submit2" type="submit">
<select id="combobox2"><option>1<option selected>2</select>
<select multiple id="listbox2"><option>1<option selected>2</select>
<textarea id="textarea2">Textarea</textarea>
</div>
<div id="console"></div>
<script>
description("This tests whether AXValue is writable for various form controls.");
if (window.testRunner && window.accessibilityController) {
jsTestIsAsync = true;
window.testRunner.dumpAsText();
function check(ids, expect, index) {
if (index >= ids.length)
finishJSTest();
id = ids[index];
window.element = document.getElementById(id);
element.focus();
setTimeout(function() {
debug(id);
shouldBe("document.activeElement == element", "true");
window.axElement = accessibilityController.focusedElement;
shouldBe("axElement.isAttributeSettable('AXValue')", String(expect[index]));
check(ids, expect, ++index);
}, 0);
}
var ids = ["text1", "text2", "number1", "number2", "textarea1", "textarea2", "slider1", "slider2", "checkbox1", "checkbox2", "radio1", "radio2", "submit1", "submit2", "combobox1", "combobox2", "listbox1", "listbox2"];
// All text-like form controls and slider should have a writable AXValue.
// Other controls whose contents or state can be user modified should have a read-only
// AXValue for non-ATSPI-based platforms, unless those controls are inside contentEditable,
// then everything should have a writable AXValue.
var expect;
if (accessibilityController.platformName != "atspi")
expect = [true, true, true, true, true, true, true, true, false, true, false, true, false, true, false, true, false, true];
else
expect = [true, true, true, true, true, true, true, true, true, true, true, true, false, true, true, true, true, true];
check(ids, expect, 0);
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>