tabs -> spaces.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@3874 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -10,42 +10,42 @@
|
|||||||
t.eq( control.displayClass, "olControlPanel", "displayClass is correct" );
|
t.eq( control.displayClass, "olControlPanel", "displayClass is correct" );
|
||||||
}
|
}
|
||||||
function test_01_Control_Panel_constructor (t) {
|
function test_01_Control_Panel_constructor (t) {
|
||||||
t.plan(5);
|
t.plan(5);
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
var panel = new OpenLayers.Control.Panel();
|
var panel = new OpenLayers.Control.Panel();
|
||||||
var toolControl = new OpenLayers.Control.ZoomBox();
|
var toolControl = new OpenLayers.Control.ZoomBox();
|
||||||
var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
|
var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
|
||||||
CLASS_NAME: 'mbControl.TestTool',
|
CLASS_NAME: 'mbControl.TestTool',
|
||||||
type: OpenLayers.Control.TYPE_TOOL
|
type: OpenLayers.Control.TYPE_TOOL
|
||||||
});
|
});
|
||||||
var anotherToolControl = new AnotherToolControl();
|
var anotherToolControl = new AnotherToolControl();
|
||||||
var ToggleControl = OpenLayers.Class(OpenLayers.Control, {
|
var ToggleControl = OpenLayers.Class(OpenLayers.Control, {
|
||||||
CLASS_NAME: 'mbControl.TestToggle',
|
CLASS_NAME: 'mbControl.TestToggle',
|
||||||
type: OpenLayers.Control.TYPE_TOGGLE
|
type: OpenLayers.Control.TYPE_TOGGLE
|
||||||
});
|
});
|
||||||
var toggleControl = new ToggleControl();
|
var toggleControl = new ToggleControl();
|
||||||
|
|
||||||
t.ok(panel instanceof OpenLayers.Control.Panel,
|
t.ok(panel instanceof OpenLayers.Control.Panel,
|
||||||
"new OpenLayers.Control.Panel returns object");
|
"new OpenLayers.Control.Panel returns object");
|
||||||
|
|
||||||
panel.addControls([toolControl, anotherToolControl, toggleControl]);
|
panel.addControls([toolControl, anotherToolControl, toggleControl]);
|
||||||
|
|
||||||
t.eq(panel.controls.length, 3,
|
t.eq(panel.controls.length, 3,
|
||||||
"added three controls to the panel");
|
"added three controls to the panel");
|
||||||
map.addControl(panel);
|
map.addControl(panel);
|
||||||
|
|
||||||
panel.activateControl(toolControl);
|
panel.activateControl(toolControl);
|
||||||
t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active,
|
t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active,
|
||||||
"activated one tool control, the other one is inactive and the toggle control also.");
|
"activated one tool control, the other one is inactive and the toggle control also.");
|
||||||
|
|
||||||
panel.activateControl(toggleControl);
|
panel.activateControl(toggleControl);
|
||||||
t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
|
t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
|
||||||
"activated the toggle control, which has no influence on the tool controls.");
|
"activated the toggle control, which has no influence on the tool controls.");
|
||||||
|
|
||||||
panel.activateControl(anotherToolControl);
|
panel.activateControl(anotherToolControl);
|
||||||
t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
|
t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
|
||||||
"activated the other tool control, the first one is inactive and the toggle control still active.");
|
"activated the other tool control, the first one is inactive and the toggle control still active.");
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
Reference in New Issue
Block a user