Changing our layers' clone methods so they create a clone of the layer state at the time of clone creation, not at the time the original was created. r=tschaub (closes #2477)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10045 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -36,12 +36,13 @@
|
||||
}
|
||||
|
||||
function test_Layer_clone (t) {
|
||||
t.plan( 8 );
|
||||
t.plan( 9 );
|
||||
|
||||
var mapone = new OpenLayers.Map('map');
|
||||
var options = { chicken: 151, foo: "bar", maxResolution: "auto" };
|
||||
var options = { chicken: 151, foo: "bar", maxResolution: "auto", visibility: false };
|
||||
var layer = new OpenLayers.Layer('Test Layer', options);
|
||||
mapone.addLayer(layer);
|
||||
layer.setVisibility(true);
|
||||
|
||||
// randomly assigned property
|
||||
layer.chocolate = 5;
|
||||
@@ -58,6 +59,8 @@
|
||||
t.ok( ((clone.options["chicken"] == 151) && (clone.options["foo"] == "bar")), "clone.options correctly set" );
|
||||
t.eq(clone.chocolate, 5, "correctly copied randomly assigned property");
|
||||
|
||||
t.eq(clone.visibility, true, "visibility correctly cloned");
|
||||
|
||||
layer.addOptions({chicken:152});
|
||||
t.eq(clone.options["chicken"], 151, "made a clean copy of options");
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
// correct bubbling up to Layer.initialize()
|
||||
t.eq( layer.name, name, "layer.name is correct" );
|
||||
t.ok( ((layer.options["chicken"] == 151) && (layer.options["foo"] == "bar")), "layer.options correctly set" );
|
||||
t.eq( layer.options, options, "layer.options correctly set" );
|
||||
|
||||
// HTTPRequest-specific properties
|
||||
t.eq( layer.url, url, "layer.name is correct" );
|
||||
|
||||
Reference in New Issue
Block a user