From 6a1cbc0953bd6e14b9156f989e47532818434ba6 Mon Sep 17 00:00:00 2001 From: scottjehl Date: Wed, 26 Jan 2011 18:07:21 -0500 Subject: [PATCH] added unit tests for path.isRelative. Test coverage for $.mobile.path is now complete! --- tests/unit/navigation/navigation_core.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index 001d465d..f7a7a415 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -87,6 +87,13 @@ same( $.mobile.path.hasProtocol( "foo/bar/baz.html" ), false, "simple directory path has no protocol" ); same( $.mobile.path.hasProtocol( "file://foo/bar/baz.html" ), true, "simple directory path with file:// has protocol" ); }); + + test( "path.isRelative is working properly", function(){ + same( $.mobile.path.isRelative("#foo/bar"), false, "path starting with a # is not relative" ); + same( $.mobile.path.isRelative("/foo/bar"), false, "path starting with a / is not relative" ); + same( $.mobile.path.isRelative("http://example.com/foo"), false, "full url path is not relative" ); + same( $.mobile.path.isRelative("foo/bar.html"), true, "simple path is relative" ); + }); test( "path.isExternal is working properly", function(){ same( $.mobile.path.isExternal( location.href ), false, "same domain is not external" );