OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset='utf-8'> |
| 5 <title>FileAPI Test: filelist</title> |
| 6 <link rel='author' title='Intel' href='http://www.intel.com'> |
| 7 <link rel='help' href='http://dev.w3.org/2006/webapi/FileAPI/#filelist-secti
on'> |
| 8 <link rel="help" href="http://dev.w3.org/2006/webapi/FileAPI/#dfn-length"> |
| 9 <link rel="help" href="http://dev.w3.org/2006/webapi/FileAPI/#dfn-item"> |
| 10 <script src='../../../../resources/testharness.js'></script> |
| 11 <script src='../../../../resources/testharnessreport.js'></script> |
| 12 </head> |
| 13 |
| 14 <body> |
| 15 <form name='uploadData' style="display:none"> |
| 16 <input type='file' id='fileChooser'> |
| 17 </form> |
| 18 <div id='log'></div> |
| 19 |
| 20 <script> |
| 21 var fileList; |
| 22 |
| 23 setup(function () { |
| 24 fileList = document.querySelector('#fileChooser').files; |
| 25 }); |
| 26 |
| 27 test(function () { |
| 28 assert_true('FileList' in window, 'window has a FileList property'); |
| 29 }, 'Check if window has a FileList property'); |
| 30 |
| 31 test(function () { |
| 32 assert_equals(FileList.length, 0, 'FileList.length is 0'); |
| 33 }, 'Check if FileList.length is 0'); |
| 34 |
| 35 test(function () { |
| 36 assert_true(fileList.item instanceof Function, 'item is a instanceof Fun
ction'); |
| 37 }, 'Check if item is a instanceof Function'); |
| 38 |
| 39 test(function() { |
| 40 assert_inherits(fileList, 'item', 'item is a method of fileList'); |
| 41 }, 'Check if item is a method of fileList'); |
| 42 |
| 43 test(function() { |
| 44 assert_equals(fileList.item(0), null, 'item method returns null'); |
| 45 }, 'Check if the item method returns null when no file selected'); |
| 46 |
| 47 test(function() { |
| 48 assert_inherits(fileList, 'length', 'length is fileList attribute'); |
| 49 }, 'Check if length is fileList\'s attribute'); |
| 50 |
| 51 test(function() { |
| 52 assert_equals(fileList.length, 0, 'fileList length is 0'); |
| 53 }, 'Check if the fileList length is 0 when no file selected'); |
| 54 </script> |
| 55 |
| 56 </body> |
| 57 </html> |
OLD | NEW |