blob: f005105bdd37846269625215663c6306fe229d32 [file] [log] [blame]
<!DOCTYPE HTML>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<style>
.hideAllContainers .container {
display: none;
}
</style>
<div class="container">
<input id="button1" type="button">
</div>
<script>
test(function(t) {
var axButtonInput1 = accessibilityController.accessibleElementById("button1");
assert_equals(axButtonInput1.name, "");
}, "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");
}, "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");
}, "Input button with value and title");
</script>
<div class="container">
<input id="button4" type="button" title="button-title4">
</div>
<script>
test(function(t) {
var axButtonInput4 = accessibilityController.accessibleElementById("button4");
assert_equals(axButtonInput4.name, "button-title4");
assert_equals(axButtonInput4.nameFrom, "title");
}, "Input button with title only");
</script>
<div class="container">
<input id="button5" type="button">
<label for="button5">button-label-5</label>
</div>
<script>
test(function(t) {
var axButtonInput5 = accessibilityController.accessibleElementById("button5");
assert_equals(axButtonInput5.name, "button-label-5");
assert_equals(axButtonInput5.nameFrom, "relatedElement");
}, "Input button with label for= and no value");
</script>
<div class="container">
<label>button-label-6<input id="button6" type="button"></label>
</div>
<script>
test(function(t) {
var axButtonInput6 = accessibilityController.accessibleElementById("button6");
assert_equals(axButtonInput6.name, "button-label-6");
assert_equals(axButtonInput6.nameFrom, "relatedElement");
}, "Input button with label wrapped and no value");
</script>
<div class="container">
<input id="button7" type="button" value="button-value7">
<label for="button7">button-label-7</label>
</div>
<script>
test(function(t) {
var axButtonInput7 = accessibilityController.accessibleElementById("button7");
assert_equals(axButtonInput7.name, "button-label-7");
assert_equals(axButtonInput7.nameFrom, "relatedElement");
}, "Input button with label for= and value");
</script>
<div class="container">
<input id="button8" type="button" value="button-value8" aria-label="button-aria-label-8">
<label for="button8">button-label-8</label>
</div>
<script>
test(function(t) {
var axButtonInput8 = accessibilityController.accessibleElementById("button8");
assert_equals(axButtonInput8.name, "button-aria-label-8");
assert_equals(axButtonInput8.nameFrom, "attribute");
}, "Input button with label for= and aria-label");
</script>
<div class="container">
<input id="button9" type="button" value="button-value9" aria-label="button-aria-label-9" aria-labelledby="label-for-button9">
<label for="button9">button-label-9</label>
<span id="label-for-button9">button9-aria-labelledby</span>
</div>
<script>
test(function(t) {
var axButtonInput9 = accessibilityController.accessibleElementById("button9");
assert_equals(axButtonInput9.name, "button9-aria-labelledby");
assert_equals(axButtonInput9.nameFrom, "relatedElement");
}, "Input button with label for=, aria-label and aria-labelledby");
</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");
}, "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");
}, "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");
}, "Submit button with title only");
</script>
<div class="container">
<input id="reset1" type="reset">
</div>
<script>
test(function(t) {
var axResetButton1 = accessibilityController.accessibleElementById("reset1");
assert_equals(axResetButton1.name, "Reset");
assert_equals(axResetButton1.nameFrom, "contents");
}, "Reset button with no value");
</script>
<div class="container">
<input id="image-input1" type="image" src="resources/cake.png">
</div>
<script>
test(function(t) {
var axImageInput1 = accessibilityController.accessibleElementById("image-input1");
assert_equals(axImageInput1.name, "Submit");
assert_equals(axImageInput1.nameFrom, "value");
}, "Image input with no value");
</script>
<div class="container">
<input id="image-input2" type="image" src="resources/cake.png" value="image-input-value2">
</div>
<script>
test(function(t) {
var axImageInput2 = accessibilityController.accessibleElementById("image-input2");
assert_equals(axImageInput2.name, "image-input-value2");
assert_equals(axImageInput2.nameFrom, "attribute");
}, "Image input with value");
</script>
<div class="container">
<input id="image-input3" type="image" src="resources/cake.png" alt="image-input-alt3">
</div>
<script>
test(function(t) {
var axImageInput3 = accessibilityController.accessibleElementById("image-input3");
assert_equals(axImageInput3.name, "image-input-alt3");
assert_equals(axImageInput3.nameFrom, "attribute");
}, "Image input with alt");
</script>
<div class="container">
<input id="image-input4" type="image" src="resources/cake.png" alt="image-input-alt4" value="image-input-value4">
</div>
<script>
test(function(t) {
var axImageInput4 = accessibilityController.accessibleElementById("image-input4");
assert_equals(axImageInput4.name, "image-input-alt4");
assert_equals(axImageInput4.nameFrom, "attribute");
}, "Image input with alt and value");
</script>
<div class="container">
<input id="image-input5" type="image" src="resources/cake.png" title="image-input-title5">
</div>
<script>
test(function(t) {
var axImageInput5 = accessibilityController.accessibleElementById("image-input5");
assert_equals(axImageInput5.name, "image-input-title5");
assert_equals(axImageInput5.nameFrom, "title");
}, "Image input with title only");
</script>
<script>
if (window.testRunner)
document.body.className = "hideAllContainers";
</script>