blob: f0d823df567c607648a959881cc33e9ea6bbc90f [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) {
window.testRunner.dumpAsText();
function check(id1, id2, expected1) {
debug(id1);
window.element1 = document.getElementById(id1);
element1.focus();
shouldBe("document.activeElement == element1", "true");
window.axElement1 = accessibilityController.focusedElement;
debug(id2);
window.element2 = document.getElementById(id2);
element2.focus();
shouldBe("document.activeElement == element2", "true");
window.axElement2 = accessibilityController.focusedElement;
shouldBe("axElement1.isAttributeSettable('AXValue')", String(expected1));
// If contentEditable, AXValue is always writable.
shouldBe("axElement2.isAttributeSettable('AXValue')", "true");
debug("");
}
// All text-like form controls should have a writable AXValue.
check("text1", "text2", true);
check("number1", "number2", true);
check("textarea1", "textarea2", true);
// A slider can set AXValue.
check("slider1", "slider2", true);
// Other controls whose contents or state can be user modified should have a read-only
// AXValue for non-ATK-based platforms, unless those controls are inside contentEditable,
// then everything should have a writable AXValue.
isATK = accessibilityController.platformName == "atk";
check("checkbox1", "checkbox2", isATK ? true : false);
check("radio1", "radio2", isATK ? true : false);
check("submit1", "submit2", false);
check("combobox1", "combobox2", isATK ? true : false);
check("listbox1", "listbox2", isATK ? true : false);
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>