fixing href regression introduced with r11978. r=bartvde (see #3351)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@12064 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2011-06-07 20:44:06 +00:00
parent e4b9ba187a
commit f27073e6d3
2 changed files with 43 additions and 2 deletions

View File

@@ -305,15 +305,22 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class(
"Get": function(node, obj) {
obj.get = {};
this.readChildNodes(node, obj.get);
// backwards compatibility
if (!obj.href) {
obj.href = obj.get.href;
}
},
"Post": function(node, obj) {
obj.post = {};
this.readChildNodes(node, obj.post);
// backwards compatibility
if (!obj.href) {
obj.href = obj.get.href;
}
},
"GetMap": function(node, obj) {
obj.getmap = {formats: []};
this.readChildNodes(node, obj.getmap);
obj.getmap.href = obj.getmap.get.href || obj.getmap.post.href; // backwards compatibility
},
"GetFeatureInfo": function(node, obj) {
obj.getfeatureinfo = {formats: []};

View File

@@ -5,7 +5,7 @@
function test_read(t) {
t.plan(17);
t.plan(23);
var xml = document.getElementById("gssample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
@@ -32,6 +32,40 @@
undefined,
"getmap.post not available"
);
var describelayer = capability.request.describelayer;
t.eq(
describelayer.href,
"http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&",
"describelayer href parsed"
);
t.eq(
describelayer.get.href,
describelayer.href,
"describelayer.get.href parsed"
);
t.eq(
describelayer.post,
undefined,
"describelayer.post not available"
);
var getfeatureinfo = capability.request.getfeatureinfo;
t.eq(
getfeatureinfo.href,
"http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&",
"getfeatureinfo href parsed"
);
t.eq(
getfeatureinfo.get.href,
getfeatureinfo.href,
"getmap.get.href parsed"
);
t.eq(
getfeatureinfo.post.href,
"http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&",
"getfeatureinfo.post set correctly"
);
t.ok(capability.layers, "layers parsed");
t.eq(capability.layers.length, 22, "correct number of layers parsed");