| Index: third_party/WebKit/LayoutTests/accessibility/aria-activedescendant.html
|
| diff --git a/third_party/WebKit/LayoutTests/accessibility/aria-activedescendant.html b/third_party/WebKit/LayoutTests/accessibility/aria-activedescendant.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ddf53e1ba51915b26df7a23176399322dcdc9e98
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/accessibility/aria-activedescendant.html
|
| @@ -0,0 +1,115 @@
|
| +<!DOCTYPE html>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +
|
| +<div id="main" role="main">
|
| +
|
| + <div id="contenteditable-textbox" role="textbox" contenteditable="true"
|
| + aria-expanded="true" aria-haspopup="true" aria-autocomplete="list"
|
| + aria-activedescendant="option1">
|
| + </div>
|
| +
|
| + <input id="input-textbox" role="textbox" type="text" aria-expanded="true"
|
| + aria-haspopup="true" aria-autocomplete="list"
|
| + aria-activedescendant="option1">
|
| +
|
| + <input id="input-combobox" role="combobox" type="search" aria-expanded="true"
|
| + aria-haspopup="true" aria-autocomplete="list"
|
| + aria-activedescendant="option1">
|
| +
|
| + <textarea id="textarea-searchbox" role="searchbox" aria-expanded="true"
|
| + aria-haspopup="true" aria-autocomplete="list"
|
| + aria-activedescendant="option1"></textarea>
|
| +
|
| + <ul id="listbox" role="listbox" style="display: none;">
|
| + <li id="option1" role="option">Option 1</li>
|
| + <li id="option2" role="option">Option 2</li>
|
| + <li id="option3" role="option">Option 3</li>
|
| + </ul>
|
| +
|
| +</div>
|
| +
|
| +<script>
|
| + function testExpectations(elementId)
|
| + {
|
| + var listbox = document.getElementById("listbox");
|
| + listbox.style.display = "block";
|
| + var textField = document.getElementById(elementId);
|
| + textField.setAttribute("aria-owns", "listbox");
|
| + textField.focus();
|
| +
|
| + var axTextField = accessibilityController.accessibleElementById(elementId);
|
| + var axListbox = accessibilityController.accessibleElementById("listbox");
|
| + var option1 = accessibilityController.accessibleElementById("option1");
|
| + var option2 = accessibilityController.accessibleElementById("option2");
|
| + var option3 = accessibilityController.accessibleElementById("option3");
|
| +
|
| + assert_true(axTextField.isExpanded, "axTextField.isExpanded");
|
| + assert_true(axTextField.hasPopup, "axTextField.hasPopup");
|
| + // According to the ARIA Spec, the presence of aria-activedescendant
|
| + // should make all children with a valid ID focusable.
|
| + assert_true(axListbox.isFocusable, "axListbox.isFocusable");
|
| + assert_true(option1.isFocusable, "option1.isFocusable");
|
| + assert_true(option1.isSelectable, "option1.isSelectable");
|
| + assert_true(option2.isFocusable, "option2.isFocusable");
|
| + assert_true(option2.isSelectable, "option2.isSelectable");
|
| + assert_true(option3.isFocusable, "option3.isFocusable");
|
| + assert_true(option3.isSelectable, "option3.isSelectable");
|
| +
|
| + assert_true(option1.isFocused, "option1.isFocused");
|
| + assert_true(option1.isSelected, "option1.isSelected");
|
| +
|
| + textField.setAttribute("aria-activedescendant", "option2");
|
| + assert_false(option1.isFocused, "option1.isFocused");
|
| + assert_false(option1.isSelected, "option1.isSelected");
|
| + assert_true(option2.isFocused, "option2.isFocused");
|
| + assert_true(option2.isSelected, "option2.isSelected");
|
| +
|
| + textField.setAttribute("aria-activedescendant", "option3");
|
| + assert_false(option2.isFocused, "option2.isFocused");
|
| + assert_false(option2.isSelected, "option2.isSelected");
|
| + assert_true(option3.isFocused, "option3.isFocused");
|
| + assert_true(option3.isSelected, "option3.isSelected");
|
| +
|
| + textField.removeAttribute("aria-activedescendant");
|
| + assert_false(option3.isFocused, "option3.isFocused");
|
| + assert_false(option3.isSelected, "option3.isSelected");
|
| + assert_true(axTextField.isFocused, "axTextField.isFocused");
|
| +
|
| + textField.removeAttribute("aria-owns");
|
| + listbox.style.display = "none";
|
| + }
|
| +</script>
|
| +
|
| +<script>
|
| + test(function()
|
| + {
|
| + testExpectations("contenteditable-textbox");
|
| + }, "Changing active descendant on a content editable.");
|
| +</script>
|
| +
|
| +<script>
|
| + test(function()
|
| + {
|
| + testExpectations("input-textbox");
|
| + }, "Changing active descendant on an input with role=textbox.");
|
| +</script>
|
| +
|
| +<script>
|
| + test(function()
|
| + {
|
| + testExpectations("input-combobox");
|
| + }, "Changing active descendant on an input of type=search with role=combobox.");
|
| +</script>
|
| +
|
| +<script>
|
| + test(function()
|
| + {
|
| + testExpectations("textarea-searchbox");
|
| + }, "Changing active descendant on a textarea with role=searchbox.");
|
| +</script>
|
| +
|
| +<script>
|
| + if (window.testRunner)
|
| + document.getElementById("main").style.display = "none";
|
| +</script>
|
|
|