chromium/third_party/blink/web_tests/accessibility/aom-float-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/

-->

<script>
if (window.internals)
    internals.runtimeFlags.accessibilityObjectModelEnabled = true;
</script>

<div role="slider" id="slider" aria-valuenow="5"></div>

<script>
test(function(t) {
    var node = document.getElementById("slider");
    var axNode = accessibilityController.accessibleElementById("slider");
    assert_equals(axNode.intValue, 5);
    assert_equals(node.accessibleNode.valueNow, null);
    node.accessibleNode.valueNow = 9;
    assert_equals(axNode.intValue, 5);
    node.accessibleNode.valueNow = null;
    assert_equals(axNode.intValue, 5);
    assert_equals(node.accessibleNode.valueNow, null);
}, "Boolean AOM properties do not reflect ARIA, and can be cleared.");
</script>

<div role="slider" id="slider2"></div>

<script>
test(function(t) {
    var node = document.getElementById("slider2");
    var axNode = accessibilityController.accessibleElementById("slider2");
    assert_equals(axNode.intValue, 50);
    assert_equals(axNode.minValue, 0);
    assert_equals(axNode.maxValue, 100);
    node.accessibleNode.valueNow = 33;
    node.accessibleNode.valueMin = -100;
    node.accessibleNode.valueMax = 100;;
    assert_equals(axNode.intValue, 50);
    assert_equals(axNode.minValue, 0);
    assert_equals(axNode.maxValue, 100);
}, "Range values in accessible node of slider.");
</script>

<div role="spinbutton" id="spinbutton"></div>

<script>
test(function(t) {
    var node = document.getElementById("spinbutton");
    var axNode = accessibilityController.accessibleElementById("spinbutton");
    assert_equals(axNode.intValue, 0);
    assert_equals(axNode.minValue, 0);
    assert_equals(axNode.maxValue, 0);
    node.accessibleNode.valueNow = 33;
    node.accessibleNode.valueMin = -100;
    node.accessibleNode.valueMax = 100;;
    assert_equals(axNode.intValue, 0);
    assert_equals(axNode.minValue, 0);
    assert_equals(axNode.maxValue, 0);
}, "Range values in accessible node of spinbutton.");
</script>