chromium/third_party/blink/web_tests/accessibility/description-calc-native-markup-input-buttons.html

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

<div class="container">
    <input id="button1" type="button">
</div>

<script>
test(function(t) {
    var axButtonInput1 = accessibilityController.accessibleElementById("button1");
    assert_equals(axButtonInput1.name, "");
    assert_equals(axButtonInput1.nameFrom, "");
    assert_equals(axButtonInput1.description, "");
    assert_equals(axButtonInput1.descriptionFrom, "");
}, "Input button with no value");
</script>

<div class="container">
    <input id="button2" type="button" value="button-value2">
</div>

<script>
test(function(t) {
    var axButtonInput2 = accessibilityController.accessibleElementById("button2");
    assert_equals(axButtonInput2.name, "button-value2");
    assert_equals(axButtonInput2.nameFrom, "value");
    assert_equals(axButtonInput2.description, "");
    assert_equals(axButtonInput2.descriptionFrom, "");
}, "Input button with value");
</script>

<div class="container">
    <input id="button3" type="button" value="button-value3" title="button-title3">
</div>

<script>
test(function(t) {
    var axButtonInput3 = accessibilityController.accessibleElementById("button3");
    assert_equals(axButtonInput3.name, "button-value3");
    assert_equals(axButtonInput3.nameFrom, "value");
    assert_equals(axButtonInput3.description, "button-title3");
    assert_equals(axButtonInput3.descriptionFrom, "title");
}, "Input button with value and title");
</script>

<div class="container">
    <input id="submit1" type="submit">
</div>

<script>
test(function(t) {
    var axSubmitButton1 = accessibilityController.accessibleElementById("submit1");
    assert_equals(axSubmitButton1.name, "Submit");
    assert_equals(axSubmitButton1.nameFrom, "contents");
    assert_equals(axSubmitButton1.description, "");
    assert_equals(axSubmitButton1.descriptionFrom, "");
}, "Submit button without value");
</script>

<div class="container">
    <input id="submit2" type="submit" value="submit-value2">
</div>

<script>
test(function(t) {
    var axSubmitButton2 = accessibilityController.accessibleElementById("submit2");
    assert_equals(axSubmitButton2.name, "submit-value2");
    assert_equals(axSubmitButton2.nameFrom, "value");
    assert_equals(axSubmitButton2.description, "");
    assert_equals(axSubmitButton2.descriptionFrom, "");
}, "Submit button with value");
</script>

<div class="container">
    <input id="submit3" type="submit" title="submit-title">
</div>

<script>
test(function(t) {
    var axSubmitButton3 = accessibilityController.accessibleElementById("submit3");
    assert_equals(axSubmitButton3.name, "Submit");
    assert_equals(axSubmitButton3.nameFrom, "contents");
    assert_equals(axSubmitButton3.description, "submit-title");
    assert_equals(axSubmitButton3.descriptionFrom, "title");
}, "Submit button with title only");
</script>

<div class="container">
    <input id="submit4" type="submit" aria-label="Label">
</div>

<script>
test(function(t) {
    var axSubmitButton4 = accessibilityController.accessibleElementById("submit4");
    assert_equals(axSubmitButton4.name, "Label");
    assert_equals(axSubmitButton4.nameFrom, "attribute");
    assert_equals(axSubmitButton4.description, "");
    assert_equals(axSubmitButton4.descriptionFrom, "");
}, "Submit button with aria-label");
</script>

<div class="container">
    <input id="submit5" type="submit" aria-label="Label" value="Value">
</div>

<script>
test(function(t) {
    var axSubmitButton5 = accessibilityController.accessibleElementById("submit5");
    assert_equals(axSubmitButton5.name, "Label");
    assert_equals(axSubmitButton5.nameFrom, "attribute");
    assert_equals(axSubmitButton5.description, "Value");
    assert_equals(axSubmitButton5.descriptionFrom, "buttonLabel");
}, "Submit button with aria-label and value");
</script>