4 <script src=
"../../../resources/js-test.js"></script>
7 <input id=
"single_file" name=
"upfile" type=
"file" />
8 <input id=
"multiple_files" name=
"upfile[]" multiple=
"multiple" type=
"file" />
9 <input id=
"single_or_multiple_file" name=
"upfile[]" type=
"file" />
10 <p>This tests the label of a file chooser button.
</p>
11 <div id=
"console"></div>
13 if (window
.testRunner
) {
14 var file
= document
.getElementById('single_file');
15 var button
= internals
.shadowRoot(file
).firstChild
;
16 var label
= button
.getAttribute('value');
17 var result
= 'The label of a single file chooser button is "' + label
+ '".';
18 label
== 'Choose File' ? testPassed(result
) : testFailed(result
);
20 file
= document
.getElementById('multiple_files');
21 button
= internals
.shadowRoot(file
).firstChild
;
22 label
= button
.getAttribute('value');
23 result
= 'The label of a multiple file chooser button is "' + label
+ '".';
24 label
== 'Choose Files' ? testPassed(result
) : testFailed(result
);
26 file
= document
.getElementById('single_or_multiple_file');
27 button
= internals
.shadowRoot(file
).firstChild
;
28 label
= button
.getAttribute('value');
29 result
= 'Initially, the label of a file chooser button is "' + label
+ '".';
30 label
== 'Choose File' ? testPassed(result
) : testFailed(result
);
32 file
.setAttribute("multiple", "multiple");
33 button
= internals
.shadowRoot(file
).firstChild
;
34 label
= button
.getAttribute('value');
35 result
= 'Set "multiple" attribute, then the label of the file chooser button becomes "' + label
+ '".';
36 label
== 'Choose Files' ? testPassed(result
) : testFailed(result
);
38 file
.removeAttribute("multiple");
39 button
= internals
.shadowRoot(file
).firstChild
;
40 label
= button
.getAttribute('value');
41 result
= 'Unset "multiple" attribute, then the label of the file chooser button becomes "' + label
+ '".';
42 label
== 'Choose File' ? testPassed(result
) : testFailed(result
);