chromium/third_party/blink/web_tests/accessibility/aria-grid-readonly-propagation.html

<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<div role="grid" id="grid-readonly-undefined">
  <div role="row">
    <div id="cell-undef-undef" role="gridcell">X</div>
    <div id="cell-undef-true" role="gridcell" aria-readonly="true">X</div>
    <div id="cell-undef-false" role="gridcell" aria-readonly="false">X</div>
  </div>
</div>

<div role="grid" id="grid-readonly-true" aria-readonly="true">
  <div role="row">
    <div id="cell-true-undef" role="gridcell">X</div>
    <div id="cell-true-false" role="gridcell" aria-readonly="false">X</div>
  </div>
</div>

<div role="grid" id="grid-readonly-false" aria-readonly="false">
  <div role="row">
    <div id="cell-false-undef" role="gridcell">X</div>
    <div id="cell-false-true" role="gridcell" aria-readonly="true">X</div>
  </div>
</div>

<div role="treegrid" id="treegrid-readonly-true" aria-readonly="true">
  <div role="row">
    <div id="treegrid-cell-true-undef" role="gridcell">X</div>
  </div>
</div>

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

test(function(t) {
    var cell = axElementById("cell-undef-undef");
    assert_equals(cell.restriction, "none");
}, "readonly=false on cell where readonly is undefined on grid+cell");

test(function(t) {
    var cell = axElementById("cell-undef-true");
    assert_equals(cell.restriction, "readOnly");
}, "readonly=true on a cell");

test(function(t) {
    var cell = axElementById("cell-undef-false");
    assert_equals(cell.restriction, "none");
}, "readonly=false on a cell");

test(function(t) {
    var cell = axElementById("cell-true-undef");
    assert_equals(cell.restriction, "readOnly");
}, "Propagation of readonly=true from grid to cells");

test(function(t) {
    var cell = axElementById("cell-true-false");
    assert_equals(cell.restriction, "none");
}, "Cell readonly=false overrides propagation of grid readonly=true");

test(function(t) {
    var cell = axElementById("cell-false-undef");
    assert_equals(cell.restriction, "none");
}, "Propagation of readonly=false from grid to cells");

test(function(t) {
    var cell = axElementById("cell-false-true");
    assert_equals(cell.restriction, "readOnly");
}, "Cell readonly=true overrides propagation of grid readonly=false");

test(function(t) {
    var cell = axElementById("treegrid-cell-true-undef");
    assert_equals(cell.restriction, "readOnly");
}, "Propagation of readonly=true in a readonly treegrid");

</script>