allow toggling TYPE_TOOL controls in panels, p=jorix, r=me (closes #3294)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11965 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Éric Lemoine
2011-05-10 07:13:22 +00:00
parent e1be8e9dfb
commit 0d45c5f148
2 changed files with 45 additions and 7 deletions

View File

@@ -247,6 +247,7 @@
t.ok(!controlNoDeactive.active, "Tool control autoActivate:true is not active");
}
function test_Control_Panel_deactivate (t) {
t.plan(2);
var map = new OpenLayers.Map('map');
@@ -262,6 +263,31 @@
map.destroy();
}
function test_allowDepress (t) {
t.plan(2);
var map = new OpenLayers.Map('map');
var panel = new OpenLayers.Control.Panel();
panel.addControls([new OpenLayers.Control(),new OpenLayers.Control()]);
map.addControl(panel);
var control1 = panel.controls[1]
panel.activateControl(control1);
panel.allowDepress = false;
panel.activateControl(control1);
t.eq(control1.active, true,
"control1 remains active after calling again activateControl when allowDepress = false");
panel.allowDepress = true;
panel.activateControl(control1);
t.eq(control1.active, false,
"control1 is inactive after calling again activateControl when allowDepress = true");
// panel.deactivate();
map.destroy();
}
</script>
</head>
<body>