Adding an autoActivate property for controls. If this is set to true, the control will be activated when it is added to a map. This is true for the Navigation, NavigationHistory, KeyboardDefaults, and Panel controls. False for others. r=elemoine (closes #2200)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9589 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -72,6 +72,31 @@
|
||||
t.ok(control.map == null, "Control.map is null");
|
||||
t.ok(control.handler == null, "Control.handler is null");
|
||||
}
|
||||
|
||||
function test_autoActivate(t) {
|
||||
|
||||
t.plan(3);
|
||||
|
||||
var control, map = new OpenLayers.Map("map");
|
||||
|
||||
// confirm that a control is not activated by default
|
||||
control = new OpenLayers.Control();
|
||||
map.addControl(control);
|
||||
t.ok(!control.active, "control is not activated by default");
|
||||
|
||||
// confirm that control is activated with autoActivate true
|
||||
control = new OpenLayers.Control({autoActivate: true});
|
||||
map.addControl(control);
|
||||
t.ok(control.active, "control is activated with autoActivate true");
|
||||
|
||||
// confirm that control is not activated with autoActivate false
|
||||
control = new OpenLayers.Control({autoActivate: false});
|
||||
map.addControl(control);
|
||||
t.ok(!control.active, "control is not activated with autoActivate false");
|
||||
|
||||
map.destroy();
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user