chromium/third_party/blink/web_tests/accessibility/aom-computed-int-properties.html

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

<!--

Accessibility Object Model
Explainer: https://github.com/WICG/aom/blob/gh-pages/explainer.md
Spec: https://wicg.github.io/aom/spec/

-->

<div id="no-int-props" role="button">Click me!</div>

<div id="list" role="list">
  <div id="listitem" role="listitem" aria-setSize="10" aria-posinset="3"></div>
</div>

<script>

test(function(t) {
    assert_true(internals.runtimeFlags.accessibilityObjectModelEnabled);
}, "Make sure that Accessibility Object Model is enabled");

promise_test(async function(test) {
    var element = document.getElementById("no-int-props");
    computedAXNode = await window.getComputedAccessibleNode(element);
    assert_equals(computedAXNode.role, "button");
    assert_equals(computedAXNode.colCount, null);
    assert_equals(computedAXNode.colIndex, null);
    assert_equals(computedAXNode.colSpan, null);
    assert_equals(computedAXNode.level, null);
    assert_equals(computedAXNode.posInSet, null);
    assert_equals(computedAXNode.rowCount, null);
    assert_equals(computedAXNode.rowIndex, null);
    assert_equals(computedAXNode.rowSpan, null);
    assert_equals(computedAXNode.setSize, null);
}, "computedAccessibleNode has nullable int properties.");

promise_test(async function(test) {
    var listitem = document.getElementById("listitem");
    computedAXNode = await window.getComputedAccessibleNode(listitem);
    assert_equals(computedAXNode.posInSet, 3);
    assert_equals(computedAXNode.setSize, 10);
}, "computedAccessibleNode.setSize and computedAccessibleNode.posInSet");

</script>

<div id="first-heading" role="heading" aria-level="1">Satu</div>
<div id="second-heading" role="heading" aria-level="2">Dua</div>
<div id="third-heading" role="heading" aria-level="2">Tiga</div>

<script>

promise_test(async function(test) {
    var heading1 = document.getElementById("first-heading");
    var heading2 = document.getElementById("second-heading");
    var heading3 = document.getElementById("third-heading");
    computedAXNode1 = await window.getComputedAccessibleNode(heading1);
    computedAXNode2 = await window.getComputedAccessibleNode(heading2);
    computedAXNode3 = await window.getComputedAccessibleNode(heading3);

    assert_equals(computedAXNode1.level, 1);
    assert_equals(computedAXNode2.level, 2);
    assert_equals(computedAXNode3.level, 2);
}, "computedAccessibleNode.level");

// TODO(meredithl): add in tests for (col | row) * (index | index | span)

</script>