mirror of
https://github.com/Hopiu/jquery-mobile.git
synced 2026-04-03 06:10:24 +00:00
test cross domain check helper
This commit is contained in:
parent
36c9d3a86b
commit
33add3b033
1 changed files with 15 additions and 0 deletions
|
|
@ -215,4 +215,19 @@
|
|||
same( $.mobile.path.cleanHash( "#anything/atall?akjfdjjf" ), "anything/atall", "removes query param");
|
||||
same( $.mobile.path.cleanHash( "#nothing/atall" ), "nothing/atall", "removes query param");
|
||||
});
|
||||
|
||||
test( "path.isPermittedCrossDomainRequest", function() {
|
||||
var fileDocUrl = $.mobile.path.parseUrl( "file://foo" );
|
||||
|
||||
$.mobile.allowCrossDomainPages = false;
|
||||
same( $.mobile.path.isPermittedCrossDomainRequest( "foo", "bar"), false, "always false from the setting");
|
||||
|
||||
|
||||
$.mobile.allowCrossDomainPages = true;
|
||||
// test the two states of the file protocol logic
|
||||
same( $.mobile.path.isPermittedCrossDomainRequest( fileDocUrl, "http://bar.com/foo"), true, "external url from file protocol succeeds");
|
||||
|
||||
same( $.mobile.path.isPermittedCrossDomainRequest( fileDocUrl, "file://foo"), false, "two file protocol urls fail");
|
||||
|
||||
});
|
||||
})(jQuery);
|
||||
Loading…
Reference in a new issue