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 <[email protected]> Authored: Tue Aug 27 17:55:46 2013 -0700 Committer: purplecabbage <[email protected]> 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);
