You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2013/11/15 20:57:19 UTC

spec commit: CB-5404: Add test for actually reading directory contents

Updated Branches:
  refs/heads/master e7c2630f4 -> d6f07da69


CB-5404: Add test for actually reading directory contents


Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/d6f07da6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/d6f07da6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/d6f07da6

Branch: refs/heads/master
Commit: d6f07da699b217eb749ac0c8da44e1d110f5b848
Parents: e7c2630
Author: Ian Clelland <ic...@chromium.org>
Authored: Fri Nov 15 13:30:43 2013 -0500
Committer: Ian Clelland <ic...@chromium.org>
Committed: Fri Nov 15 13:35:01 2013 -0500

----------------------------------------------------------------------
 autotest/tests/file.tests.js | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/d6f07da6/autotest/tests/file.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/file.tests.js b/autotest/tests/file.tests.js
index 2ccba6d..ab02752 100644
--- a/autotest/tests/file.tests.js
+++ b/autotest/tests/file.tests.js
@@ -1034,6 +1034,24 @@ describe('File API', function() {
                     expect(fail).not.toHaveBeenCalled();
                 });
             });
+            it("file.spec.37.1 should read contents of existing directory", function(done) {
+                var fail = createFail('DirectoryReader', done),
+                    dirName = 'readEntries.dir',
+                    fileName = 'readeEntries.file';
+                root.getDirectory(dirName, {create: true}, function(directory) {
+                    directory.getFile(fileName, {create: true}, function(fileEntry) {
+                        var reader = directory.createReader();
+                        reader.readEntries(function(entries) {
+                            expect(entries).toBeDefined();
+                            expect(entries instanceof Array).toBe(true);
+                            expect(entries.length).toBe(1);
+                            expect(entries[0].fullPath).toCanonicallyMatch(fileEntry.fullPath);
+                            // cleanup
+                            directory.removeRecursively(done, fail);
+                        }, fail);
+                    }, fail);
+                }, fail);
+            });
             it("file.spec.109 should return an empty entry list on the second call", function() {
                 var reader,
                     firstWin = jasmine.createSpy().andCallFake(function(entries) {