"New permalink code maintains existing parameters ... including the
lat/lon/zoom/layers." Reported by bobkare (thx, bobkare!) with a patch by same, rewritten by Schuyler, reviewed by me -- and I'm committing because Schuyler's whitespace was bad. (RC1, here we come!) git-svn-id: http://svn.openlayers.org/trunk/openlayers@4345 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -39,11 +39,11 @@
|
||||
if (!map.getCenter()) map.zoomToMaxExtent();
|
||||
map.addControl(control);
|
||||
map.pan(5, 0);
|
||||
t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=BT"), 'pan sets permalink');
|
||||
t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"?zoom=2&lat=0&lon=1.75781&layers=BT"), 'pan sets permalink');
|
||||
|
||||
map.layers[1].setVisibility(false);
|
||||
|
||||
t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"?lat=0&lon=1.75781&zoom=2&layers=BF"), 'setVisibility sets permalink');
|
||||
t.ok(OpenLayers.Util.isEquivalentUrl(OpenLayers.Util.getElement('permalink').href, location+"?zoom=2&lat=0&lon=1.75781&layers=BF"), 'setVisibility sets permalink');
|
||||
}
|
||||
function test_03_Control_Permalink_updateLinksBase (t) {
|
||||
t.plan( 2 );
|
||||
@@ -56,7 +56,7 @@
|
||||
if (!map.getCenter()) map.zoomToMaxExtent();
|
||||
map.addControl(control);
|
||||
map.pan(5, 0);
|
||||
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?lat=0&lon=1.75781&zoom=2&layers=B';
|
||||
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?zoom=2&lat=0&lon=1.75781&layers=B';
|
||||
t.eq(OpenLayers.Util.getElement('permalink').href, OpenLayers.Util.getElement('edit_permalink').href, "Panning sets permalink with base");
|
||||
}
|
||||
function test_04_Control_Permalink_noElement (t) {
|
||||
@@ -77,7 +77,7 @@
|
||||
if (!map.getCenter()) map.zoomToMaxExtent();
|
||||
map.addControl(control);
|
||||
map.pan(5, 0);
|
||||
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?foo=bar&lat=0&lon=1.75781&zoom=2&layers=B';
|
||||
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?foo=bar&zoom=2&lat=0&lon=1.75781&layers=B';
|
||||
t.eq(OpenLayers.Util.getElement('permalink').href, OpenLayers.Util.getElement('edit_permalink').href, "Panning sets permalink with base and querystring");
|
||||
|
||||
control = new OpenLayers.Control.Permalink('permalink', "./edit.html?foo=bar&" );
|
||||
@@ -86,7 +86,7 @@
|
||||
t.eq(OpenLayers.Util.getElement('permalink').href, OpenLayers.Util.getElement('edit_permalink').href, "Panning sets permalink with base and querystring ending with '&'");
|
||||
|
||||
control = new OpenLayers.Control.Permalink('permalink', "./edit.html?" );
|
||||
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?lat=0&lon=1.75781&zoom=2&layers=B';
|
||||
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?zoom=2&lat=0&lon=1.75781&layers=B';
|
||||
map.addControl(control);
|
||||
map.pan(5, 0);
|
||||
map.pan(-5, 0);
|
||||
@@ -94,6 +94,20 @@
|
||||
|
||||
}
|
||||
|
||||
function test_06_Control_Permalink_nonRepeating (t) {
|
||||
t.plan( 2 );
|
||||
|
||||
control = new OpenLayers.Control.Permalink('permalink', "./edit.html?zoom=3" );
|
||||
t.ok( control instanceof OpenLayers.Control.Permalink, "new OpenLayers.Control returns object" );
|
||||
map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS('Test Layer', "http://octo.metacarta.com/cgi-bin/mapserv", {map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'});
|
||||
map.addLayer(layer);
|
||||
if (!map.getCenter()) map.zoomToMaxExtent();
|
||||
map.addControl(control);
|
||||
map.pan(5, 0);
|
||||
OpenLayers.Util.getElement('edit_permalink').href = './edit.html?zoom=2&lat=0&lon=1.75781&layers=B';
|
||||
t.eq(OpenLayers.Util.getElement('permalink').href, OpenLayers.Util.getElement('edit_permalink').href, "Panning sets permalink with existing zoom in base");
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user