blob: 695ccc47c37d52e0fa279f3e32f93ca71efb239f [file] [log] [blame]
Joshua Bell3f001762017-10-05 03:33:011<!DOCTYPE html>
2<meta charset=utf-8>
3<title>Entries API: File webitRelativePath manual test</title>
4<link rel=help href="https://wicg.github.io/entries-api/#file-interface">
5<script src="/resources/testharness.js"></script>
6<script src="/resources/testharnessreport.js"></script>
7
8Select the <b>support/a</b> directory:
9
10<input type=file multiple webkitdirectory>
11
12<script>
13setup({explicit_timeout: true});
14
15const filesPromise = new Promise(resolve => {
16 const elem = document.querySelector('input[type=file]');
17 elem.addEventListener('change', e => resolve(elem.files));
18});
19
20promise_test(t => filesPromise.then(files => {
21 assert_equals(files.length, 3, 'expected 3 items');
22 files = Array.from(files).sort(
23 (a, b) => a.name < b.name ? -1 : b.name < a.name ? 1 : 0);
24 assert_equals(files[0].name, '1.txt');
25 assert_equals(files[1].name, '2.txt');
Joshua Bell378b79a2018-11-09 17:06:0126 assert_equals(files[2].name, '3.txt');
27 assert_equals(files[0].webkitRelativePath, 'a/b/c/d/1.txt');
28 assert_equals(files[1].webkitRelativePath, 'a/b/c/d/2.txt');
29 assert_equals(files[2].webkitRelativePath, 'a/b/c/3.txt');
Joshua Bell3f001762017-10-05 03:33:0130
31}), 'webkitRelativePath is shortest common ancestor');
32
33</script>