test alterations for absolute navigation

This commit is contained in:
John Bender 2011-04-18 21:46:46 -07:00
parent 8e42b52767
commit 49b1b780ed
2 changed files with 5 additions and 5 deletions

View file

@ -166,7 +166,7 @@
};
test( "when loading a page where data-url is not defined on a sub element hash defaults to the url", function(){
testDataUrlHash("#non-data-url a", /^#data-url-tests\/non-data-url.html$/);
testDataUrlHash("#non-data-url a", new RegExp("^#/tests/unit/navigation/data-url-tests/non-data-url.html$"));
});
test( "data url works for nested paths", function(){

View file

@ -40,7 +40,7 @@
same( $.mobile.path.makeAbsolute("test.html"), "bar/test.html", "prefixes path with absolute base path from hash");
$.mobile.path.set("bar");
same( $.mobile.path.makeAbsolute("test.html"), "test.html", "returns the relative path unaltered for non path hash");
same( $.mobile.path.makeAbsolute("test.html"), "/tests/unit/navigation/test.html", "returns the absolute path unaltered ignoring non path hash");
$.mobile.path.set("bar/bing/bang");
same( $.mobile.path.makeAbsolute("?foo=bar&bak=baz"), "bar/bing/bang?foo=bar&bak=baz", "appends query string paths to current path");
@ -59,13 +59,13 @@
var localroot = location.protocol + "//" + location.host + location.pathname,
remoteroot = "http://google.com/",
fakepath = "#foo/bar/baz.html",
pathWithParam = localroot + "/bar?baz=" + localroot,
pathWithParam = localroot + "bar?baz=" + localroot,
localpath = localroot + fakepath,
remotepath = remoteroot + fakepath;
same( $.mobile.path.clean( localpath ), fakepath, "removes location protocol, host, port, pathname from same-domain path");
same( $.mobile.path.clean( localpath ), location.pathname + fakepath, "removes location protocol, host, and portfrom same-domain path");
same( $.mobile.path.clean( remotepath ), remotepath, "does nothing to an external domain path");
same( $.mobile.path.clean( pathWithParam ), "/bar?baz=" + localroot, "doesn't remove params with localroot value");
same( $.mobile.path.clean( pathWithParam ), location.pathname + "bar?baz=" + localroot, "doesn't remove params with localroot value");
});
test( "path.stripHash is working properly", function(){