OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="resources/file-drag-common.js"></script> |
2 <body> | 3 <body> |
3 <p>Resetting a file upload control by script should clear the icon.</p> | 4 <p>Resetting a file upload control by script should clear the icon.</p> |
4 <p>Manual test: Select a file for the file upload control, and confirm it has no
icon.</p> | 5 <p>Manual test: Select a file for the file upload control, and confirm it has no
icon.</p> |
5 <input id=file1 type=file> | 6 <input id=file1 type=file> |
6 </form> | 7 </form> |
7 <script> | 8 <script> |
8 function dragFilesOntoElement(element, files) { | |
9 eventSender.beginDragWithFiles(files); | |
10 var centerX = element.offsetLeft + element.offsetWidth / 2; | |
11 var centerY = element.offsetTop + element.offsetHeight / 2; | |
12 eventSender.mouseMoveTo(centerX, centerY); | |
13 eventSender.mouseUp(); | |
14 } | |
15 | |
16 function handleChange() { | 9 function handleChange() { |
17 file1.value = ''; | 10 file1.value = ''; |
18 } | 11 } |
19 | 12 |
20 var file1 = document.getElementById('file1'); | 13 var file1 = document.getElementById('file1'); |
21 file1.addEventListener('change', handleChange); | 14 file1.addEventListener('change', handleChange); |
22 dragFilesOntoElement(file1, ['foo.txt']); | 15 dragFilesOntoElement(file1, ['foo.txt']); |
23 </script> | 16 </script> |
24 </body> | 17 </body> |
OLD | NEW |