file-manual.html (1422B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>input type file</title> 4 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> 5 <link rel=help href="https://html.spec.whatwg.org/multipage/#file-upload-state-(type=file)"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <div id="log"></div> 9 <p>Manual test: clicking on the input should open a prompt allowing you to select a file.</p> 10 <input type=file id=file> 11 <script> 12 setup({explicit_timeout:true}); 13 14 var input = document.getElementById('file'), 15 t1 = async_test("selecting files should fire the input event at the input element"), 16 t2 = async_test("selecting files should fire the change event at the input element"); 17 18 document.getElementById('file').oninput = t1.step_func_done(function(e) { 19 assert_true(e.bubbles, "input event bubbles"); 20 assert_true(e.isTrusted, "input event should be trusted"); 21 assert_false(e.cancelable, "input event should not be cancelable"); 22 }) 23 document.getElementById('file').onchange = t2.step_func_done(function(e) { 24 assert_true(e.bubbles, "change event bubbles"); 25 assert_true(e.isTrusted, "change event should be trusted"); 26 assert_false(e.cancelable, "change event should not be cancelable"); 27 assert_true(input.files instanceof FileList); 28 assert_equals(input.value, "C:\\fakepath\\" + input.files[0].name); 29 }) 30 </script>