blob: 36b6c16af95a5d1219bc3ac0cbfd2e08566f327a [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body id="body">
<div id="content">
<!-- These reflect the native writable state, but can be overridden by @aria-readonly. -->
<div contenteditable id="htmlEditableDiv" data-expectedwritable="true"></div>
<div contenteditable id="htmlEditableDiv2" aria-readonly="true" data-expectedwritable="false"></div>
<div contenteditable id="htmlEditableDiv3" aria-readonly="false" data-expectedwritable="true"></div>
<div role="group" contenteditable id="htmlEditableDiv4" data-expectedwritable="true"></div>
<div role="group" contenteditable id="htmlEditableDiv5" aria-readonly="true" data-expectedwritable="false"></div>
<div role="group" contenteditable id="htmlEditableDiv6" aria-readonly="false" data-expectedwritable="true"></div>
<div role="group" id="htmlNonEditableDiv" data-expectedwritable="false"></div>
<div role="group" id="htmlNonEditableDiv2" aria-readonly="true" data-expectedwritable="false"></div>
<div role="group" id="htmlNonEditableDiv3" aria-readonly="false" data-expectedwritable="true"></div>
<div role="textbox" aria-readonly="false" aria-multiline="false" id="ariaTextBox" tabindex="0" data-expectedwritable="true"></div>
<div role="textbox" aria-readonly="true" id="ariaReadOnlyAriaTextBox" tabindex="0" data-expectedwritable="false"></div>
<!-- These are all readonly b/c the explicit boolean attr @readonly trumps @aria-readonly on native form elements. -->
<input type="text" readonly="readonly" id="htmlReadOnlyTextField" size=20 data-expectedwritable="false">
<input type="text" readonly id="htmlReadOnlyTextField2" size=20 data-expectedwritable="false">
<input type="text" readonly="readonly" aria-readonly="false" id="htmlReadOnlyTextField3" size=20 data-expectedwritable="false">
<input type="text" readonly aria-readonly="false" id="htmlReadOnlyTextField4" size=20 data-expectedwritable="false">
<textarea rows="2" cols="20" readonly="readonly" id="htmlReadOnlyTextArea" data-expectedwritable="false"></textarea>
<textarea rows="2" cols="20" readonly id="htmlReadOnlyTextArea2" data-expectedwritable="false"></textarea>
<textarea rows="2" cols="20" readonly aria-readonly="true" id="htmlReadOnlyTextArea3" data-expectedwritable="false"></textarea>
<textarea rows="2" cols="20" readonly aria-readonly="false" id="htmlReadOnlyTextArea3" data-expectedwritable="false"></textarea>
<!-- These are all writable b/c the implicit boolean attr @readonly is false, and trumps @aria-readonly on native form elements. -->
<input type="text" id="textField" size=20 data-expectedwritable="true">
<input type="text" aria-readonly="true" id="ariaReadOnlyTextField" size=20 data-expectedwritable="true">
<input type="text" aria-readonly="false" id="ariaNonReadOnlyTextField" size=20 data-expectedwritable="true">
<textarea rows="2" cols="20" id="textArea" data-expectedwritable="true"></textarea>
<textarea rows="2" cols="20" id="textArea2" aria-readonly="true" data-expectedwritable="true"></textarea>
<textarea rows="2" cols="20" id="textArea3" aria-readonly="false" data-expectedwritable="true"></textarea>
<!-- aria-readonly is also allowed on gridcells and grids -->
<div role="grid"><div role="row"><div role="gridcell" aria-readonly="true" id="ariaGridCell" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid"><div role="row"><div role="gridcell" aria-readonly="false" id="ariaGridCell2" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid"><div role="row"><div role="columnheader" aria-readonly="true" id="ariaColumnHeader" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid"><div role="row"><div role="columnheader" aria-readonly="false" id="ariaColumnHeader2" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid"><div role="row"><div role="rowheader" aria-readonly="true" id="ariaRowHeader" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid"><div role="row"><div role="rowheader" aria-readonly="false" id="ariaRowHeader2" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid" aria-readonly="true" id="ariaGrid" tabindex="0" data-expectedwritable="false"><div role="row"><div role="gridcell"></div></div></div>
<div role="grid" aria-readonly="false" id="ariaGrid2" tabindex="0" data-expectedwritable="true"><div role="row"><div role="gridcell"></div></div></div>
<div role="treegrid" aria-readonly="true" id="ariaTreeGrid" tabindex="0" data-expectedwritable="false"><div role="row"><div role="gridcell"></div></div></div>
<div role="treegrid" aria-readonly="false" id="ariaTreeGrid2" tabindex="0" data-expectedwritable="true"><div role="row"><div role="gridcell"></div></div></div>
<!--aria-readonly should be propagated to gridcells if the property is not set on the gridcell -->
<div role="grid" aria-readonly="true"><div role="row"><div role="gridcell" id="ariaGridCell3" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid" aria-readonly="false"><div role="row"><div role="gridcell" id="ariaGridCell4" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid" aria-readonly="false"><div role="row"><div role="gridcell" aria-readonly="true" id="ariaGridCell5" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid" aria-readonly="true"><div role="row"><div role="gridcell" aria-readonly="false" id="ariaGridCell6" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid" aria-readonly="true"><div role="row"><div role="columnheader" id="ariaColumnHeader3" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid" aria-readonly="false"><div role="row"><div role="columnheader" id="ariaColumnHeader4" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid" aria-readonly="false"><div role="row"><div role="columnheader" aria-readonly="true" id="ariaColumnHeader5" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid" aria-readonly="true"><div role="row"><div role="columnheader" aria-readonly="false" id="ariaColumnHeader6" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid" aria-readonly="true"><div role="row"><div role="rowheader" id="ariaRowHeader3" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid" aria-readonly="false"><div role="row"><div role="rowheader" id="ariaRowHeader4" tabindex="0" data-expectedwritable="true"></div></div></div>
<div role="grid" aria-readonly="false"><div role="row"><div role="rowheader" aria-readonly="true" id="ariaRowHeader5" tabindex="0" data-expectedwritable="false"></div></div></div>
<div role="grid" aria-readonly="true"><div role="row"><div role="rowheader" aria-readonly="false" id="ariaRowHeader6" tabindex="0" data-expectedwritable="true"></div></div></div>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that the readonly state of the AXValue property is correctly reported for native and non-native elements.");
if (window.accessibilityController) {
var result = document.getElementById('console');
var elements = document.querySelectorAll('[data-expectedwritable]');
result.innerText += "Elements to test: " + elements.length + "\n\n";
for (var i = 0, c = elements.length; i < c; i++) {
var el = elements[i];
var id = el.id;
var axElement = accessibilityController.accessibleElementById(id);
var writable = axElement.isAttributeSettable("AXValue");
// Test whether AXValue is writable.
var passed = el.getAttribute('data-expectedwritable') === writable.toString();
var output = (passed ? "PASS" : "FAIL") + " " + id + "IsWritable is " + writable;
if (!passed)
output += ", expected " + el.getAttribute("data-expectedwritable");
result.innerText += output + "\n";
}
document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>