Index: LayoutTests/accessibility/name-calc-inputs.html |
diff --git a/LayoutTests/accessibility/name-calc-inputs.html b/LayoutTests/accessibility/name-calc-inputs.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9b845ec130394e4fcf5dcc183c48830aa043cdd3 |
--- /dev/null |
+++ b/LayoutTests/accessibility/name-calc-inputs.html |
@@ -0,0 +1,89 @@ |
+<!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="text1" type="text"> |
+</div> |
+ |
+<script> |
+test(function(t) { |
+ var axTextInput1 = accessibilityController.accessibleElementById("text1"); |
+ assert_equals(axTextInput1.name, ""); |
+}, "Text input"); |
+</script> |
+ |
+<div class="container"> |
+ <input id="text2" type="text" title="text2-title"> |
+</div> |
+ |
+<script> |
+test(function(t) { |
+ var axTextInput2 = accessibilityController.accessibleElementById("text2"); |
+ assert_equals(axTextInput2.name, "text2-title"); |
+ assert_equals(axTextInput2.nameFrom, "attribute"); |
+}, "Text input with title"); |
+</script> |
+ |
+<div class="container"> |
+ <input id="text3" type="text" title="text3-title" placeholder="text3-placeholder"> |
+</div> |
+ |
+<script> |
+test(function(t) { |
+ var axTextInput3 = accessibilityController.accessibleElementById("text3"); |
+ assert_equals(axTextInput3.name, "text3-placeholder"); |
+ assert_equals(axTextInput3.nameFrom, "placeholder"); |
+}, "Text input with title and placeholder"); |
+</script> |
+ |
+<div class="container"> |
+ <input id="text4" type="text" title="text4-title" placeholder="text4-placeholder"> |
+ <label for="text4">label-for-text4</label> |
+</div> |
+ |
+<script> |
+test(function(t) { |
+ var axTextInput4 = accessibilityController.accessibleElementById("text4"); |
+ assert_equals(axTextInput4.name, "label-for-text4"); |
+ assert_equals(axTextInput4.nameFrom, "relatedElement"); |
+}, "Text input with title, placeholder and label-for"); |
+</script> |
+ |
+<div class="container"> |
+ <input id="text5" type="text" title="text5-title" placeholder="text5-placeholder" aria-label="text5-aria-label"> |
+ <label for="text5">label-for-text5</label> |
+</div> |
+ |
+<script> |
+test(function(t) { |
+ var axTextInput5 = accessibilityController.accessibleElementById("text5"); |
+ assert_equals(axTextInput5.name, "text5-aria-label"); |
+ assert_equals(axTextInput5.nameFrom, "attribute"); |
+}, "Text input with title, placeholder, label-for and aria-label"); |
+</script> |
+ |
+<div class="container"> |
+ <input id="text6" type="text" title="text6-title" placeholder="text6-placeholder" aria-label="text6-aria-label" aria-labelledby="labelledby6"> |
+ <label for="text6">label-for-text6</label> |
+ <span id="labelledby6">labelledby-for-text6</span> |
+</div> |
+ |
+<script> |
+test(function(t) { |
+ var axTextInput6 = accessibilityController.accessibleElementById("text6"); |
+ assert_equals(axTextInput6.name, "labelledby-for-text6"); |
+ assert_equals(axTextInput6.nameFrom, "relatedElement"); |
+}, "Text input with title, placeholder, label-for, aria-label and aria-labelledby"); |
+</script> |
+ |
+<script> |
+if (window.testRunner) |
+ document.body.className = "hideAllContainers"; |
+</script> |