Pull up changes for 2.8.
Fix for ArcIMS GetFeatureInfo broken (Closes #2110) createUrlObject not working in IE (Closes #2060) git-svn-id: http://svn.openlayers.org/branches/openlayers/2.8@9414 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
110
tests/Util.html
110
tests/Util.html
@@ -680,6 +680,116 @@
|
||||
t.ok(OpenLayers.Util.isEquivalentUrl(url1, url2), "absolute and relative path without host works for "+url2)
|
||||
}
|
||||
|
||||
function test_createUrlObject(t) {
|
||||
|
||||
var cases = [{
|
||||
url: "http://example.com/",
|
||||
exp: {
|
||||
protocol: "http:",
|
||||
host: "example.com",
|
||||
port: "80",
|
||||
pathname: "/",
|
||||
args: {},
|
||||
hash: ""
|
||||
}
|
||||
}, {
|
||||
url: "http://example.com:80/",
|
||||
opt: {ignorePort80: true},
|
||||
exp: {
|
||||
protocol: "http:",
|
||||
host: "example.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
args: {},
|
||||
hash: ""
|
||||
}
|
||||
}, {
|
||||
url: "http://example.com/",
|
||||
opt: {ignorePort80: true},
|
||||
exp: {
|
||||
protocol: "http:",
|
||||
host: "example.com",
|
||||
port: "",
|
||||
pathname: "/",
|
||||
args: {},
|
||||
hash: ""
|
||||
}
|
||||
}, {
|
||||
url: "http://example.com:88/",
|
||||
exp: {
|
||||
protocol: "http:",
|
||||
host: "example.com",
|
||||
port: "88",
|
||||
pathname: "/",
|
||||
args: {},
|
||||
hash: ""
|
||||
}
|
||||
}, {
|
||||
url: "http://example.com:88/foo#bar",
|
||||
exp: {
|
||||
protocol: "http:",
|
||||
host: "example.com",
|
||||
port: "88",
|
||||
pathname: "/foo",
|
||||
args: {},
|
||||
hash: "#bar"
|
||||
}
|
||||
}, {
|
||||
url: "http://example.com:88/?foo=bar",
|
||||
exp: {
|
||||
protocol: "http:",
|
||||
host: "example.com",
|
||||
port: "88",
|
||||
pathname: "/",
|
||||
args: {foo: "bar"},
|
||||
hash: ""
|
||||
}
|
||||
}, {
|
||||
url: "http://example.com/bogus/../bogus/../path",
|
||||
exp: {
|
||||
protocol: "http:",
|
||||
host: "example.com",
|
||||
port: "80",
|
||||
pathname: "/path",
|
||||
args: {},
|
||||
hash: ""
|
||||
}
|
||||
}, {
|
||||
url: "/relative#foo",
|
||||
exp: {
|
||||
protocol: window.location.protocol,
|
||||
host: window.location.hostname,
|
||||
port: window.location.port || "80",
|
||||
pathname: "/relative",
|
||||
args: {},
|
||||
hash: "#foo"
|
||||
}
|
||||
}, {
|
||||
url: "../foo",
|
||||
exp: {
|
||||
protocol: window.location.protocol,
|
||||
host: window.location.hostname,
|
||||
port: window.location.port || "80",
|
||||
pathname: (function() {
|
||||
var parts = window.location.pathname.split("/");
|
||||
return parts.slice(0, parts.length -2).join("/") + "/foo";
|
||||
})(),
|
||||
args: {},
|
||||
hash: ""
|
||||
}
|
||||
}];
|
||||
|
||||
t.plan(cases.length);
|
||||
|
||||
var c, obj;
|
||||
for(var i=0; i<cases.length; ++i) {
|
||||
c = cases[i];
|
||||
obj = OpenLayers.Util.createUrlObject(c.url, c.opt);
|
||||
t.eq(obj, c.exp, i + ": '" + c.url + "'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function test_Util_createUniqueIDSeq(t) {
|
||||
t.plan(1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user