You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/08/28 02:56:28 UTC

[1/2] spec commit: added missing test page, only run windows phone tests on windows phone

Updated Branches:
  refs/heads/master 376416a3c -> ab9ba6a0a


added missing test page, only run windows phone tests on windows phone


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

Branch: refs/heads/master
Commit: fdf656813e7dbe61ca8c28e28aa69b1c66436980
Parents: 376416a
Author: purplecabbage <pu...@gmail.com>
Authored: Tue Aug 27 15:51:21 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Tue Aug 27 15:51:21 2013 -0700

----------------------------------------------------------------------
 autotest/pages/localXHR.html     | 70 +++++++++++++++++++++++++++++++++++
 autotest/tests/localXHR.tests.js | 44 ++++++++++++++++------
 2 files changed, 102 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/fdf65681/autotest/pages/localXHR.html
----------------------------------------------------------------------
diff --git a/autotest/pages/localXHR.html b/autotest/pages/localXHR.html
new file mode 100644
index 0000000..2e64007
--- /dev/null
+++ b/autotest/pages/localXHR.html
@@ -0,0 +1,70 @@
+<!DOCTYPE html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+
+<html>
+<head>
+  <title>Cordova: Local XHR Specs</title>
+
+  <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" />
+
+  <!-- Load jasmine -->
+  <link href="../jasmine.css" rel="stylesheet"/>
+  <script type="text/javascript" src="../jasmine.js"></script>
+  <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script>
+  <script type="text/javascript" src="../html/HtmlReporter.js"></script>
+  <script type="text/javascript" src="../html/ReporterView.js"></script>
+  <script type="text/javascript" src="../html/SpecView.js"></script>
+  <script type="text/javascript" src="../html/SuiteView.js"></script>
+  <script type="text/javascript" src="../html/TrivialReporter.js"></script>
+
+  <!-- Source -->
+  <script type="text/javascript" src="../../cordova-incl.js"></script>
+
+  <!-- Load Test Runner -->
+  <script type="text/javascript" src="../test-runner.js"></script>
+
+  <!-- Tests -->
+  <script type="text/javascript" src="../tests/localXHR.tests.js"></script>
+
+  <script type="text/javascript">
+      document.addEventListener('deviceready', function () {
+          var jasmineEnv = jasmine.getEnv();
+          jasmineEnv.updateInterval = 1000;
+
+          var htmlReporter = new jasmine.HtmlReporter();
+
+          jasmineEnv.addReporter(htmlReporter);
+
+          jasmineEnv.specFilter = function (spec) {
+              return htmlReporter.specFilter(spec);
+          };
+
+          jasmineEnv.execute();
+      }, false);
+  </script>
+</head>
+
+<body>
+  <a href="javascript:" class="backBtn" onclick="backHome();">Back</a>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/fdf65681/autotest/tests/localXHR.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/localXHR.tests.js b/autotest/tests/localXHR.tests.js
index 3713603..e0bab1e 100644
--- a/autotest/tests/localXHR.tests.js
+++ b/autotest/tests/localXHR.tests.js
@@ -93,17 +93,37 @@ describe("XMLHttpRequest", function () {
         waitsForAny(win, lose);
     });
 
-    it("XMLHttpRequest.spec.5 should be able to load the (WP8 backwards compatability) root page www/index.html", function () {
-        var win = jasmine.createSpy().andCallFake(function (res) {});
-        var lose = createDoNotCallSpy('xhrFail');
-        var xhr = createXHR("www/index.html", true, win, lose);
-        waitsForAny(win, lose);
-    });
 
-    it("XMLHttpRequest.spec.6 should be able to load the (WP7 backwards compatability) root page app/www/index.html", function () {
-        var win = jasmine.createSpy().andCallFake(function (res) {});
-        var lose = createDoNotCallSpy('xhrFail');
-        var xhr = createXHR("app/www/index.html", true, win, lose);
-        waitsForAny(win, lose);
+});
+
+// only add these tests if we are testing on windows phone
+
+if (/Windows Phone/.exec(navigator.userAgent)) {
+
+    var createXHR = function (url, bAsync, win, lose) {
+        var xhr = new XMLHttpRequest();
+        xhr.open("GET", url, bAsync);
+        xhr.onload = win;
+        xhr.onerror = lose;
+        xhr.send();
+        return xhr;
+    }
+
+    describe("XMLHttpRequest Windows Phone", function () {
+
+        console.log("running special windows tests");
+        it("XMLHttpRequest.spec.5 should be able to load the (WP8 backwards compatability) root page www/index.html", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR("www/index.html", true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+        it("XMLHttpRequest.spec.6 should be able to load the (WP7 backwards compatability) root page app/www/index.html", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR("app/www/index.html", true, win, lose);
+            waitsForAny(win, lose);
+        });
     });
-});
\ No newline at end of file
+}
\ No newline at end of file


[2/2] spec commit: added tests for hash routes like #some/path and ./index.html

Posted by pu...@apache.org.
added tests for hash routes like #some/path and ./index.html


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

Branch: refs/heads/master
Commit: ab9ba6a0a2a6a1160150ffa4a33736d255f9ce9d
Parents: fdf6568
Author: purplecabbage <pu...@gmail.com>
Authored: Tue Aug 27 17:55:46 2013 -0700
Committer: purplecabbage <pu...@gmail.com>
Committed: Tue Aug 27 17:55:46 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/ab9ba6a0/autotest/tests/localXHR.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/localXHR.tests.js b/autotest/tests/localXHR.tests.js
index e0bab1e..9b4cd8b 100644
--- a/autotest/tests/localXHR.tests.js
+++ b/autotest/tests/localXHR.tests.js
@@ -93,6 +93,22 @@ describe("XMLHttpRequest", function () {
         waitsForAny(win, lose);
     });
 
+    it("XMLHttpRequest.spec.5 should be able to load the current page ./???.html", function () {
+        var win = jasmine.createSpy().andCallFake(function (res) { });
+        var lose = createDoNotCallSpy('xhrFail');
+        var fileName = window.location.href.split('#')[0].split('/').pop();
+        var xhr = createXHR("./" + fileName, true, win, lose);
+        waitsForAny(win, lose);
+    });
+
+    it("XMLHttpRequest.spec.6 adds hash-path and loads file okay", function () {
+        window.location = window.location.href + "#asd/asd/asdasd";
+        var win = jasmine.createSpy().andCallFake(function (res) { });
+        var lose = createDoNotCallSpy('xhrFail');
+        var xhr = createXHR(window.location.href, true, win, lose);
+        waitsForAny(win, lose);
+    });
+
 
 });
 
@@ -112,14 +128,14 @@ if (/Windows Phone/.exec(navigator.userAgent)) {
     describe("XMLHttpRequest Windows Phone", function () {
 
         console.log("running special windows tests");
-        it("XMLHttpRequest.spec.5 should be able to load the (WP8 backwards compatability) root page www/index.html", function () {
+        it("XMLHttpRequest.spec.7 should be able to load the (WP8 backwards compatability) root page www/index.html", function () {
             var win = jasmine.createSpy().andCallFake(function (res) { });
             var lose = createDoNotCallSpy('xhrFail');
             var xhr = createXHR("www/index.html", true, win, lose);
             waitsForAny(win, lose);
         });
 
-        it("XMLHttpRequest.spec.6 should be able to load the (WP7 backwards compatability) root page app/www/index.html", function () {
+        it("XMLHttpRequest.spec.8 should be able to load the (WP7 backwards compatability) root page app/www/index.html", function () {
             var win = jasmine.createSpy().andCallFake(function (res) { });
             var lose = createDoNotCallSpy('xhrFail');
             var xhr = createXHR("app/www/index.html", true, win, lose);