|
63 | 63 | p15 = "http://jqm.com/dir1/dir2/test.php#spaz",
|
64 | 64 | p16 = "http://jqm.com/dir1/dir2/test.php?foo=1&bar=2#spaz";
|
65 | 65 |
|
66 |
| - // Test URL conversion against an absolute URL to the site root. |
67 |
| - |
68 |
| - // directory tests |
69 |
| - same( mua( "http://jqm.com/", p1 ), "http://jqm.com/", "absolute root - absolute root" ); |
70 |
| - same( mua( "//jqm.com/", p1 ), "http://jqm.com/", "protocol relative root - absolute root" ); |
71 |
| - same( mua( "/", p1 ), "http://jqm.com/", "site relative root - absolute root" ); |
72 |
| - |
73 |
| - same( mua( "http://jqm.com/?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "absolute root with query - absolute root" ); |
74 |
| - same( mua( "//jqm.com/?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "protocol relative root with query - absolute root" ); |
75 |
| - same( mua( "/?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "site relative root with query - absolute root" ); |
76 |
| - same( mua( "?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "query relative - absolute root" ); |
77 |
| - |
78 |
| - same( mua( "http://jqm.com/#spaz", p1 ), "http://jqm.com/#spaz", "absolute root with fragment - absolute root" ); |
79 |
| - same( mua( "//jqm.com/#spaz", p1 ), "http://jqm.com/#spaz", "protocol relative root with fragment - absolute root" ); |
80 |
| - same( mua( "/#spaz", p1 ), "http://jqm.com/#spaz", "site relative root with fragment - absolute root" ); |
81 |
| - same( mua( "#spaz", p1 ), "http://jqm.com/#spaz", "fragment relative - absolute root" ); |
82 |
| - |
83 |
| - same( mua( "http://jqm.com/?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "absolute root with query and fragment - absolute root" ); |
84 |
| - same( mua( "//jqm.com/?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "protocol relative root with query and fragment - absolute root" ); |
85 |
| - same( mua( "/?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "site relative root with query and fragment - absolute root" ); |
86 |
| - same( mua( "?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "query relative and fragment - absolute root" ); |
87 |
| - |
88 |
| - // file tests |
89 |
| - same( mua( "http://jqm.com/test.php", p1 ), "http://jqm.com/test.php", "absolute file at root - absolute root" ); |
90 |
| - same( mua( "//jqm.com/test.php", p1 ), "http://jqm.com/test.php", "protocol relative file at root - absolute root" ); |
91 |
| - same( mua( "/test.php", p1 ), "http://jqm.com/test.php", "site relative file at root - absolute root" ); |
92 |
| - same( mua( "test.php", p1 ), "http://jqm.com/test.php", "document relative file at root - absolute root" ); |
93 |
| - |
94 |
| - same( mua( "http://jqm.com/test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "absolute file at root with query - absolute root" ); |
95 |
| - same( mua( "//jqm.com/test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "protocol relative file at root with query - absolute root" ); |
96 |
| - same( mua( "/test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "site relative file at root with query - absolute root" ); |
97 |
| - same( mua( "test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "document relative file at root with query - absolute root" ); |
98 |
| - |
99 |
| - same( mua( "http://jqm.com/test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "absolute file at root with fragment - absolute root" ); |
100 |
| - same( mua( "//jqm.com/test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "protocol relative file at root with fragment - absolute root" ); |
101 |
| - same( mua( "/test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "site relative file at root with fragment - absolute root" ); |
102 |
| - same( mua( "test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "file at root with fragment - absolute root" ); |
103 |
| - |
104 |
| - same( mua( "http://jqm.com/test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "absolute file at root with query and fragment - absolute root" ); |
105 |
| - same( mua( "//jqm.com/test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "protocol relative file at root with query and fragment - absolute root" ); |
106 |
| - same( mua( "/test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "site relative file at root with query and fragment - absolute root" ); |
107 |
| - same( mua( "test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "query relative file at root fragment - absolute root" ); |
108 |
| - |
109 |
| - // Test URL conversion against an absolute URL to a file at the site root. |
110 |
| - |
111 |
| - same( mua( "http://jqm.com/", p5 ), "http://jqm.com/", "absolute root - absolute root" ); |
112 |
| - same( mua( "//jqm.com/", p5 ), "http://jqm.com/", "protocol relative root - absolute root" ); |
113 |
| - same( mua( "/", p5 ), "http://jqm.com/", "site relative root - absolute root" ); |
114 |
| - |
115 |
| - same( mua( "http://jqm.com/?foo=1&bar=2", p5 ), "http://jqm.com/?foo=1&bar=2", "absolute root with query - absolute root" ); |
116 |
| - same( mua( "//jqm.com/?foo=1&bar=2", p5 ), "http://jqm.com/?foo=1&bar=2", "protocol relative root with query - absolute root" ); |
117 |
| - same( mua( "/?foo=1&bar=2", p5 ), "http://jqm.com/?foo=1&bar=2", "site relative root with query - absolute root" ); |
118 |
| - same( mua( "?foo=1&bar=2", p5 ), "http://jqm.com/test.php?foo=1&bar=2", "query relative - absolute root" ); |
119 |
| - |
120 |
| - same( mua( "http://jqm.com/#spaz", p5 ), "http://jqm.com/#spaz", "absolute root with fragment - absolute root" ); |
121 |
| - same( mua( "//jqm.com/#spaz", p5 ), "http://jqm.com/#spaz", "protocol relative root with fragment - absolute root" ); |
122 |
| - same( mua( "/#spaz", p5 ), "http://jqm.com/#spaz", "site relative root with fragment - absolute root" ); |
123 |
| - same( mua( "#spaz", p5 ), "http://jqm.com/test.php#spaz", "fragment relative - absolute root" ); |
124 |
| - |
125 |
| - same( mua( "http://jqm.com/?foo=1&bar=2#spaz", p5 ), "http://jqm.com/?foo=1&bar=2#spaz", "absolute root with query and fragment - absolute root" ); |
126 |
| - same( mua( "//jqm.com/?foo=1&bar=2#spaz", p5 ), "http://jqm.com/?foo=1&bar=2#spaz", "protocol relative root with query and fragment - absolute root" ); |
127 |
| - same( mua( "/?foo=1&bar=2#spaz", p5 ), "http://jqm.com/?foo=1&bar=2#spaz", "site relative root with query and fragment - absolute root" ); |
128 |
| - same( mua( "?foo=1&bar=2#spaz", p5 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "query relative and fragment - absolute root" ); |
| 66 | + // Test URL conversion against an absolute URL to the site root. |
| 67 | + // directory tests |
| 68 | + same( mua( "http://jqm.com/", p1 ), "http://jqm.com/", "absolute root - absolute root" ); |
| 69 | + same( mua( "//jqm.com/", p1 ), "http://jqm.com/", "protocol relative root - absolute root" ); |
| 70 | + same( mua( "/", p1 ), "http://jqm.com/", "site relative root - absolute root" ); |
| 71 | + |
| 72 | + same( mua( "http://jqm.com/?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "absolute root with query - absolute root" ); |
| 73 | + same( mua( "//jqm.com/?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "protocol relative root with query - absolute root" ); |
| 74 | + same( mua( "/?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "site relative root with query - absolute root" ); |
| 75 | + same( mua( "?foo=1&bar=2", p1 ), "http://jqm.com/?foo=1&bar=2", "query relative - absolute root" ); |
| 76 | + |
| 77 | + same( mua( "http://jqm.com/#spaz", p1 ), "http://jqm.com/#spaz", "absolute root with fragment - absolute root" ); |
| 78 | + same( mua( "//jqm.com/#spaz", p1 ), "http://jqm.com/#spaz", "protocol relative root with fragment - absolute root" ); |
| 79 | + same( mua( "/#spaz", p1 ), "http://jqm.com/#spaz", "site relative root with fragment - absolute root" ); |
| 80 | + same( mua( "#spaz", p1 ), "http://jqm.com/#spaz", "fragment relative - absolute root" ); |
| 81 | + |
| 82 | + same( mua( "http://jqm.com/?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "absolute root with query and fragment - absolute root" ); |
| 83 | + same( mua( "//jqm.com/?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "protocol relative root with query and fragment - absolute root" ); |
| 84 | + same( mua( "/?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "site relative root with query and fragment - absolute root" ); |
| 85 | + same( mua( "?foo=1&bar=2#spaz", p1 ), "http://jqm.com/?foo=1&bar=2#spaz", "query relative and fragment - absolute root" ); |
| 86 | + |
| 87 | + // file tests |
| 88 | + same( mua( "http://jqm.com/test.php", p1 ), "http://jqm.com/test.php", "absolute file at root - absolute root" ); |
| 89 | + same( mua( "//jqm.com/test.php", p1 ), "http://jqm.com/test.php", "protocol relative file at root - absolute root" ); |
| 90 | + same( mua( "/test.php", p1 ), "http://jqm.com/test.php", "site relative file at root - absolute root" ); |
| 91 | + same( mua( "test.php", p1 ), "http://jqm.com/test.php", "document relative file at root - absolute root" ); |
| 92 | + |
| 93 | + same( mua( "http://jqm.com/test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "absolute file at root with query - absolute root" ); |
| 94 | + same( mua( "//jqm.com/test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "protocol relative file at root with query - absolute root" ); |
| 95 | + same( mua( "/test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "site relative file at root with query - absolute root" ); |
| 96 | + same( mua( "test.php?foo=1&bar=2", p1 ), "http://jqm.com/test.php?foo=1&bar=2", "document relative file at root with query - absolute root" ); |
| 97 | + |
| 98 | + same( mua( "http://jqm.com/test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "absolute file at root with fragment - absolute root" ); |
| 99 | + same( mua( "//jqm.com/test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "protocol relative file at root with fragment - absolute root" ); |
| 100 | + same( mua( "/test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "site relative file at root with fragment - absolute root" ); |
| 101 | + same( mua( "test.php#spaz", p1 ), "http://jqm.com/test.php#spaz", "file at root with fragment - absolute root" ); |
| 102 | + |
| 103 | + same( mua( "http://jqm.com/test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "absolute file at root with query and fragment - absolute root" ); |
| 104 | + same( mua( "//jqm.com/test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "protocol relative file at root with query and fragment - absolute root" ); |
| 105 | + same( mua( "/test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "site relative file at root with query and fragment - absolute root" ); |
| 106 | + same( mua( "test.php?foo=1&bar=2#spaz", p1 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "query relative file at root fragment - absolute root" ); |
| 107 | + |
| 108 | + // Test URL conversion against an absolute URL to a file at the site root. |
| 109 | + |
| 110 | + same( mua( "http://jqm.com/", p5 ), "http://jqm.com/", "absolute root - absolute root" ); |
| 111 | + same( mua( "//jqm.com/", p5 ), "http://jqm.com/", "protocol relative root - absolute root" ); |
| 112 | + same( mua( "/", p5 ), "http://jqm.com/", "site relative root - absolute root" ); |
| 113 | + |
| 114 | + same( mua( "http://jqm.com/?foo=1&bar=2", p5 ), "http://jqm.com/?foo=1&bar=2", "absolute root with query - absolute root" ); |
| 115 | + same( mua( "//jqm.com/?foo=1&bar=2", p5 ), "http://jqm.com/?foo=1&bar=2", "protocol relative root with query - absolute root" ); |
| 116 | + same( mua( "/?foo=1&bar=2", p5 ), "http://jqm.com/?foo=1&bar=2", "site relative root with query - absolute root" ); |
| 117 | + same( mua( "?foo=1&bar=2", p5 ), "http://jqm.com/test.php?foo=1&bar=2", "query relative - absolute root" ); |
| 118 | + |
| 119 | + same( mua( "http://jqm.com/#spaz", p5 ), "http://jqm.com/#spaz", "absolute root with fragment - absolute root" ); |
| 120 | + same( mua( "//jqm.com/#spaz", p5 ), "http://jqm.com/#spaz", "protocol relative root with fragment - absolute root" ); |
| 121 | + same( mua( "/#spaz", p5 ), "http://jqm.com/#spaz", "site relative root with fragment - absolute root" ); |
| 122 | + same( mua( "#spaz", p5 ), "http://jqm.com/test.php#spaz", "fragment relative - absolute root" ); |
| 123 | + |
| 124 | + same( mua( "http://jqm.com/?foo=1&bar=2#spaz", p5 ), "http://jqm.com/?foo=1&bar=2#spaz", "absolute root with query and fragment - absolute root" ); |
| 125 | + same( mua( "//jqm.com/?foo=1&bar=2#spaz", p5 ), "http://jqm.com/?foo=1&bar=2#spaz", "protocol relative root with query and fragment - absolute root" ); |
| 126 | + same( mua( "/?foo=1&bar=2#spaz", p5 ), "http://jqm.com/?foo=1&bar=2#spaz", "site relative root with query and fragment - absolute root" ); |
| 127 | + same( mua( "?foo=1&bar=2#spaz", p5 ), "http://jqm.com/test.php?foo=1&bar=2#spaz", "query relative and fragment - absolute root" ); |
129 | 128 | });
|
130 | 129 |
|
131 | 130 | test( "path.clean is working properly", function(){
|
|
156 | 155 | same( $.mobile.path.isRelativeUrl("http://company.com/"), false, "absolute url is not relative" );
|
157 | 156 | same( $.mobile.path.isRelativeUrl("//company.com/"), true, "protocol relative url is relative" );
|
158 | 157 | same( $.mobile.path.isRelativeUrl("/"), true, "site relative url is relative" );
|
159 |
| - |
| 158 | + |
160 | 159 | same( $.mobile.path.isRelativeUrl("http://company.com/test.php"), false, "absolute url is not relative" );
|
161 | 160 | same( $.mobile.path.isRelativeUrl("//company.com/test.php"), true, "protocol relative url is relative" );
|
162 | 161 | same( $.mobile.path.isRelativeUrl("/test.php"), true, "site relative url is relative" );
|
163 | 162 | same( $.mobile.path.isRelativeUrl("test.php"), true, "document relative url is relative" );
|
164 |
| - |
| 163 | + |
165 | 164 | same( $.mobile.path.isRelativeUrl("http://company.com/dir1/dir2/test.php?foo=1&bar=2#frag"), false, "absolute url is not relative" );
|
166 | 165 | same( $.mobile.path.isRelativeUrl("//company.com/dir1/dir2/test.php?foo=1&bar=2#frag"), true, "protocol relative url is relative" );
|
167 | 166 | same( $.mobile.path.isRelativeUrl("/dir1/dir2/test.php?foo=1&bar=2#frag"), true, "site relative url is relative" );
|
|
0 commit comments