2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
6 .hideAllContainers .container {
11 <div class=
"container">
12 <input id=
"text1" type=
"text">
17 var axTextInput1
= accessibilityController
.accessibleElementById("text1");
18 assert_equals(axTextInput1
.name
, "");
22 <div class=
"container">
23 <input id=
"text2" type=
"text" title=
"text2-title">
28 var axTextInput2
= accessibilityController
.accessibleElementById("text2");
29 assert_equals(axTextInput2
.name
, "text2-title");
30 assert_equals(axTextInput2
.nameFrom
, "attribute");
31 }, "Text input with title");
34 <div class=
"container">
35 <input id=
"text3" type=
"text" title=
"text3-title" placeholder=
"text3-placeholder">
40 var axTextInput3
= accessibilityController
.accessibleElementById("text3");
41 assert_equals(axTextInput3
.name
, "text3-placeholder");
42 assert_equals(axTextInput3
.nameFrom
, "placeholder");
43 }, "Text input with title and placeholder");
46 <div class=
"container">
47 <input id=
"text4" type=
"text" title=
"text4-title" placeholder=
"text4-placeholder">
48 <label for=
"text4">label-for-text4
</label>
53 var axTextInput4
= accessibilityController
.accessibleElementById("text4");
54 assert_equals(axTextInput4
.name
, "label-for-text4");
55 assert_equals(axTextInput4
.nameFrom
, "relatedElement");
56 }, "Text input with title, placeholder and label-for");
59 <div class=
"container">
60 <input id=
"text5" type=
"text" title=
"text5-title" placeholder=
"text5-placeholder" aria-label=
"text5-aria-label">
61 <label for=
"text5">label-for-text5
</label>
66 var axTextInput5
= accessibilityController
.accessibleElementById("text5");
67 assert_equals(axTextInput5
.name
, "text5-aria-label");
68 assert_equals(axTextInput5
.nameFrom
, "attribute");
69 }, "Text input with title, placeholder, label-for and aria-label");
72 <div class=
"container">
73 <input id=
"text6" type=
"text" title=
"text6-title" placeholder=
"text6-placeholder" aria-label=
"text6-aria-label" aria-labelledby=
"labelledby6">
74 <label for=
"text6">label-for-text6
</label>
75 <span id=
"labelledby6">labelledby-for-text6
</span>
80 var axTextInput6
= accessibilityController
.accessibleElementById("text6");
81 assert_equals(axTextInput6
.name
, "labelledby-for-text6");
82 assert_equals(axTextInput6
.nameFrom
, "relatedElement");
83 }, "Text input with title, placeholder, label-for, aria-label and aria-labelledby");
87 if (window
.testRunner
)
88 document
.body
.className
= "hideAllContainers";