Add new tests for Icon cloning. Modify Icon.js to correct incorrect case in constructor call in clone().
git-svn-id: http://svn.openlayers.org/trunk/openlayers@109 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -14,6 +14,6 @@ OpenLayers.Icon.prototype = {
|
|||||||
|
|
||||||
// Create a copy of this icon.
|
// Create a copy of this icon.
|
||||||
clone: function() {
|
clone: function() {
|
||||||
return new OpenLayers.icon(this.size, this.url);
|
return new OpenLayers.Icon(this.size, this.url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,16 @@
|
|||||||
t.eq( icon.size.h, 6, "icon.size.w returns correct value" );
|
t.eq( icon.size.h, 6, "icon.size.w returns correct value" );
|
||||||
t.eq( icon.url, "", "icon.url returns str object" );
|
t.eq( icon.url, "", "icon.url returns str object" );
|
||||||
}
|
}
|
||||||
|
function test_02_Icon_clone (t) {
|
||||||
|
t.plan( 4 );
|
||||||
|
icon = new OpenLayers.Icon("a",new OpenLayers.Size(5,6));
|
||||||
|
t.ok( icon instanceof OpenLayers.Icon, "new OpenLayers.Icon returns Icon object" );
|
||||||
|
var cloned = icon.clone();
|
||||||
|
t.ok( cloned instanceof OpenLayers.Icon, "clone is an OpenLayers.Icon" );
|
||||||
|
cloned.url = "b"
|
||||||
|
t.eq( icon.url, "a", "icon.url doesn't change with clone's url" );
|
||||||
|
t.eq( cloned.url, "b", "cloned.url does change when edited" );
|
||||||
|
}
|
||||||
|
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user