chromium/third_party/blink/web_tests/accessibility/aria-toggle-button-with-title.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body id="body">

<a id="tbutton" tabindex="0" class="button" role="button" aria-pressed="true">Toggle button</a>

<div>
<button type="button" id="button" role="button"/>
<label>Button title</label>
</div>

<script>

test((t) => {
    document.getElementById("tbutton").focus();
    tbutton1 = accessibilityController.focusedElement;
    assert_equals(tbutton1.role, "AXRole: AXToggleButton");
    assert_equals(tbutton1.name, 'Toggle button');

    document.getElementById("button").focus();
    button = accessibilityController.focusedElement;
    assert_equals(button.role, "AXRole: AXButton");
    assert_equals(button.name, 'Button title');
}, "This tests that a toggle button properly exposes the title when there isn't a direct relation and textUnderElement is required to be used.");

</script>
</body>
</html>