| Joshua Bell | 2f76ef2 | 2017-10-11 16:22:23 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <meta charset=utf-8> |
| 3 | <title>Entries API: FileSystemFileEntry file() manual test</title> |
| 4 | <link rel=help href="https://wicg.github.io/entries-api/#api-entry"> |
| 5 | <script src="/resources/testharness.js"></script> |
| 6 | <script src="/resources/testharnessreport.js"></script> |
| 7 | <script src="support.js"></script> |
| 8 | |
| 9 | <script> |
| 10 | |
| 11 | file_entry_test('file.txt', (t, entry) => { |
| 12 | assert_idl_attribute(entry, 'file', 'FileSystemFileEntry has a file() method'); |
| 13 | assert_equals(typeof entry.file, 'function', 'FileSystemFileEntry has a file() method'); |
| 14 | |
| Stephen McGruer | f065235 | 2020-01-23 17:35:56 | [diff] [blame] | 15 | assert_throws_js(TypeError, () => entry.file(), 'file() has a required argument'); |
| Joshua Bell | 2f76ef2 | 2017-10-11 16:22:23 | [diff] [blame] | 16 | entry.file(t.step_func(file => { |
| 17 | |
| 18 | assert_class_string(file, 'File', 'file() should yield a File'); |
| 19 | assert_equals(entry.name, file.name, 'entry and file names should match'); |
| 20 | t.done(); |
| 21 | |
| 22 | }), t.unreached_func('file() should not fail')); |
| 23 | }, 'FileSystemFileEntry - file()'); |
| 24 | |
| 25 | // TODO: Manual test where file is replaced with directory before file() called |
| 26 | </script> |