Skip to content

Commit

Permalink
Only get the FileList once.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ms2ger committed Jan 29, 2015
1 parent 25a8f3f commit c5fe468
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions FileAPI/filelist-section/filelist.html
Expand Up @@ -20,38 +20,35 @@
<script>
var fileList;

test(function () {
setup(function () {
fileList = document.querySelector('#fileChooser').files;
});

test(function () {
assert_true('FileList' in window, 'window has a FileList property');
}, 'Check if window has a FileList property');

test(function () {
fileList = document.querySelector('#fileChooser').files;
assert_equals(FileList.length, 0, 'FileList.length is 0');
}, 'Check if FileList.length is 0');

test(function () {
fileList = document.querySelector('#fileChooser').files;
assert_true(fileList.item instanceof Function, 'item is a instanceof Function');
}, 'Check if item is a instanceof Function');

test(function() {
fileList = document.querySelector('#fileChooser').files;
assert_inherits(fileList, 'item', 'item is a method of fileList');
}, 'Check if item is a method of fileList');

test(function() {
fileList = document.querySelector('#fileChooser').files;
assert_equals(fileList.item(0), null, 'item method returns null');
}, 'Check if the item method returns null when no file selected');

test(function() {
fileList = document.querySelector('#fileChooser').files;
assert_inherits(fileList, 'length', 'length is fileList attribute');
}, 'Check if length is fileList\'s attribute');

test(function() {
fileList = document.querySelector('#fileChooser').files;
assert_equals(fileList.length, 0, 'fileList length is 0');
}, 'Check if the fileList length is 0 when no file selected');
</script>
Expand Down

0 comments on commit c5fe468

Please sign in to comment.