chromium/third_party/blink/web_tests/accessibility/disabled-not-selectable.html

<!DOCTYPE HTML>
<!-- Disabled subwidgets can have selected state, but are not selectable -->
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<div id="treeitem1" role="treeitem" tabindex="-1" aria-selected="false">X</div>
<div id="option1" role="option" tabindex="-1">X</div>
<div id="tab1" role="tab" tabindex="-1">X</div>
<div role="grid">
  <div id="gridcell1" role="gridcell" tabindex="-1" aria-selected="false">X</div>
</div>
<div id="checkbox1" role="checkbox" tabindex="-1">X</div>

<div id="treeitem2" role="treeitem" tabindex="-1" aria-selected="true">X</div>
<div id="option2" role="option" tabindex="-1" aria-selected="true">X</div>
<div id="tab2" role="tab" tabindex="-1" aria-selected="true">X</div>
<div role="grid">
  <div id="gridcell2" role="gridcell" tabindex="-1" aria-selected="true">X</div>
</div>
<div id="checkbox2" role="checkbox" tabindex="-1" aria-selected="true">X</div>

<div id="treeitem3" role="treeitem" tabindex="-1" aria-selected="true" aria-disabled="true">X</div>
<div id="option3" role="option" tabindex="-1" aria-selected="true" aria-disabled="true">X</div>
<div id="tab3" role="tab" tabindex="-1" aria-selected="true" aria-disabled="true">X</div>
<div role="grid">
  <div id="gridcell3" role="gridcell" tabindex="-1" aria-selected="true" aria-disabled="true">X</div>
</div>

<script>
var listbox = document.getElementById("listbox");

function axElementById(id) {
    return accessibilityController.accessibleElementById(id);
}

test(function(t) {
    var ax = axElementById("treeitem1");
    assert_equals(ax.restriction, "none");
}, "Tree item enabled");

test(function(t) {
    var ax = axElementById("option1");
    assert_equals(ax.restriction, "none");
}, "Option enabled");

test(function(t) {
    var ax = axElementById("tab1");
    assert_equals(ax.restriction, "none");
}, "Tab enabled");

test(function(t) {
    var ax = axElementById("gridcell1");
    assert_equals(ax.restriction, "none");
}, "Grid cell enabled");

test(function(t) {
    var ax = axElementById("checkbox1");
    assert_equals(ax.restriction, "none");
}, "Check boxs enabled");

test(function(t) {
    var ax = axElementById("treeitem1");
    assert_equals(ax.isSelectable, true);
}, "Tree item selectable");

test(function(t) {
    var ax = axElementById("option1");
    assert_equals(ax.isSelectable, true);
}, "Option selectable");

test(function(t) {
    var ax = axElementById("tab1");
    assert_equals(ax.isSelectable, true);
}, "Tab selectable");

test(function(t) {
    var ax = axElementById("gridcell1");
    assert_equals(ax.isSelectable, true);
}, "Grid cell selectable");

test(function(t) {
    var ax = axElementById("checkbox1");
    assert_equals(ax.isSelectable, false);
}, "Check box not selectable because it is not a selectable role");

test(function(t) {
    var ax = axElementById("treeitem2");
    assert_equals(ax.isSelected, true);
}, "Tree item selected");

test(function(t) {
    var ax = axElementById("option2");
    assert_equals(ax.isSelected, true);
}, "Option selected");

test(function(t) {
    var ax = axElementById("tab2");
    assert_equals(ax.isSelected, true);
}, "Tab selected");

test(function(t) {
    var ax = axElementById("gridcell2");
    assert_equals(ax.isSelected, true);
}, "Grid cell selected");

test(function(t) {
    var ax = axElementById("checkbox2");
    assert_equals(ax.isSelected, false);
}, "Check box not selected because it is not a selectable role");

test(function(t) {
    var ax = axElementById("treeitem3");
    assert_equals(ax.isSelectable, false);
}, "Tree item not selectable if disabled");

test(function(t) {
    var ax = axElementById("option3");
    assert_equals(ax.isSelectable, false);
}, "Option not selectable if disabled");

test(function(t) {
    var ax = axElementById("tab3");
    assert_equals(ax.isSelectable, false);
}, "Tab not selectable if disabled");

test(function(t) {
    var ax = axElementById("gridcell3");
    assert_equals(ax.isSelectable, false);
}, "Grid cell not selectable if disabled");

test(function(t) {
    var ax = axElementById("treeitem3");
    assert_equals(ax.isSelected, true);
}, "Tree item can still have selected state if disabled");

test(function(t) {
    var ax = axElementById("option3");
    assert_equals(ax.isSelected, true);
}, "Option can still have selected state if disabled");

test(function(t) {
    var ax = axElementById("tab3");
    assert_equals(ax.isSelected, true);
}, "Tab can still have selected state if disabled");

test(function(t) {
    var ax = axElementById("gridcell3");
    assert_equals(ax.isSelected, true);
}, "Grid cell can still have selected state if disabled");



</script>