| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <input id="single_file" name="upfile" type="file" /> |
| <input id="multiple_files" name="upfile[]" multiple="multiple" type="file" /> |
| <input id="single_or_multiple_file" name="upfile[]" type="file" /> |
| <p>This tests the label of a file chooser button.</p> |
| <div id="console"></div> |
| <script> |
| if (window.testRunner) { |
| var file = document.getElementById('single_file'); |
| var button = internals.shadowRoot(file).firstChild; |
| var label = button.getAttribute('value'); |
| var result = 'The label of a single file chooser button is "' + label + '".'; |
| label == 'Choose File' ? testPassed(result) : testFailed(result); |
| |
| file = document.getElementById('multiple_files'); |
| button = internals.shadowRoot(file).firstChild; |
| label = button.getAttribute('value'); |
| result = 'The label of a multiple file chooser button is "' + label + '".'; |
| label == 'Choose Files' ? testPassed(result) : testFailed(result); |
| |
| file = document.getElementById('single_or_multiple_file'); |
| button = internals.shadowRoot(file).firstChild; |
| label = button.getAttribute('value'); |
| result = 'Initially, the label of a file chooser button is "' + label + '".'; |
| label == 'Choose File' ? testPassed(result) : testFailed(result); |
| |
| file.setAttribute("multiple", "multiple"); |
| button = internals.shadowRoot(file).firstChild; |
| label = button.getAttribute('value'); |
| result = 'Set "multiple" attribute, then the label of the file chooser button becomes "' + label + '".'; |
| label == 'Choose Files' ? testPassed(result) : testFailed(result); |
| |
| file.removeAttribute("multiple"); |
| button = internals.shadowRoot(file).firstChild; |
| label = button.getAttribute('value'); |
| result = 'Unset "multiple" attribute, then the label of the file chooser button becomes "' + label + '".'; |
| label == 'Choose File' ? testPassed(result) : testFailed(result); |
| } |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |