blob: e7e14f015b7bbd198d389a0d8995da835db2310b [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/run-after-layout-and-paint.js"></script>
<div id="main" role="main">
<input id="input" type="text" value="Line 1">
<div id="contenteditable-textbox" role="textbox" contenteditable="true">
<input id="inner-input" value="Line 1">
<textarea id="inner-textarea" rows="1" cols="40">Line 2</textarea>
</div>
<div id="contenteditable-div" contenteditable>
<p id="paragraph1">Line 1<br>
Line 2</p>
<p id="paragraph2">Line 3</p>
</div>
</div>
<script>
test_after_layout_and_paint(function() {
var axInput = accessibilityController.accessibleElementById('input');
assert_true(axInput.isEditableRoot);
}, 'An input element is an editable root.');
test_after_layout_and_paint(function() {
var axContentEditable = accessibilityController.accessibleElementById('contenteditable-textbox');
assert_true(axContentEditable.isEditableRoot);
}, 'A content editable with a role of textbox is an editable root.');
test_after_layout_and_paint(function() {
var axInnerInput = accessibilityController.accessibleElementById('inner-input');
assert_true(axInnerInput.isEditableRoot);
}, 'An input element embedded inside a content editable is an editable root.');
test_after_layout_and_paint(function() {
var axInnerTextarea = accessibilityController.accessibleElementById('inner-textarea');
assert_true(axInnerTextarea.isEditableRoot);
}, 'A textarea embedded inside a content editable is an editable root.');
test_after_layout_and_paint(function() {
var axContentEditable = accessibilityController.accessibleElementById('contenteditable-div');
var axParagraph1 = accessibilityController.accessibleElementById('paragraph1');
var axParagraph2 = accessibilityController.accessibleElementById('paragraph2');
assert_true(axContentEditable.isEditableRoot);
assert_false(axParagraph1.isEditableRoot);
assert_false(axParagraph2.isEditableRoot);
}, 'A paragraph within a content editable is not an editable root but the content editable is.');
</script>