You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/05/16 03:02:03 UTC

spec commit: CB-285 Tests for cordova.file.*Directory properties for iOS & Android

Repository: cordova-mobile-spec
Updated Branches:
  refs/heads/master c0ed3d7ce -> 0993ad3fd


CB-285 Tests for cordova.file.*Directory properties for iOS & Android


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/0993ad3f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/0993ad3f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/0993ad3f

Branch: refs/heads/master
Commit: 0993ad3fdd5da52bfc9fc3339acf923cff483456
Parents: c0ed3d7
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu May 15 21:01:45 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu May 15 21:02:00 2014 -0400

----------------------------------------------------------------------
 autotest/tests/file.tests.js | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/0993ad3f/autotest/tests/file.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/file.tests.js b/autotest/tests/file.tests.js
index e9d5788..d7c8ed7 100644
--- a/autotest/tests/file.tests.js
+++ b/autotest/tests/file.tests.js
@@ -4425,6 +4425,25 @@ describe('File API', function() {
                 expect(validateFile).toHaveBeenCalled();
             });
         });
-
+        it("file.spec.129 cordova.file.*Directory are set", function() {
+            var expectedPaths = [
+                'applicationDirectory',
+                'applicationStorageDirectory',
+                'dataDirectory',
+                'cacheDirectory'
+            ];
+            if (cordova.platformId == 'android') {
+                expectedPaths.push('externalApplicationStorageDirectory', 'externalRootDirectory', 'externalCacheDirectory', 'externalDataDirectory');
+            } else if (cordova.platformId == 'ios') {
+                expectedPaths.push('syncedDataDirectory', 'documentsDirectory', 'tempDirectory');
+            } else {
+                console.log('Skipping test due on unsupported platform.');
+                return;
+            }
+            for (var i = 0; i < expectedPaths.length; ++i) {
+                expect(typeof cordova.file[expectedPaths[i]]).toBe('string');
+                expect(cordova.file[expectedPaths[i]]).toMatch(/\/$/, 'Path should end with a slash');
+            }
+        });
     });
 });