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" );
|
||||
}
|
||||
function test_01_Control_Panel_constructor (t) {
|
||||
t.plan(5);
|
||||
var map = new OpenLayers.Map('map');
|
||||
var panel = new OpenLayers.Control.Panel();
|
||||
var toolControl = new OpenLayers.Control.ZoomBox();
|
||||
var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
|
||||
CLASS_NAME: 'mbControl.TestTool',
|
||||
type: OpenLayers.Control.TYPE_TOOL
|
||||
});
|
||||
var anotherToolControl = new AnotherToolControl();
|
||||
var ToggleControl = OpenLayers.Class(OpenLayers.Control, {
|
||||
CLASS_NAME: 'mbControl.TestToggle',
|
||||
type: OpenLayers.Control.TYPE_TOGGLE
|
||||
});
|
||||
var toggleControl = new ToggleControl();
|
||||
t.plan(5);
|
||||
var map = new OpenLayers.Map('map');
|
||||
var panel = new OpenLayers.Control.Panel();
|
||||
var toolControl = new OpenLayers.Control.ZoomBox();
|
||||
var AnotherToolControl = OpenLayers.Class(OpenLayers.Control, {
|
||||
CLASS_NAME: 'mbControl.TestTool',
|
||||
type: OpenLayers.Control.TYPE_TOOL
|
||||
});
|
||||
var anotherToolControl = new AnotherToolControl();
|
||||
var ToggleControl = OpenLayers.Class(OpenLayers.Control, {
|
||||
CLASS_NAME: 'mbControl.TestToggle',
|
||||
type: OpenLayers.Control.TYPE_TOGGLE
|
||||
});
|
||||
var toggleControl = new ToggleControl();
|
||||
|
||||
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,
|
||||
"added three controls to the panel");
|
||||
"added three controls to the panel");
|
||||
map.addControl(panel);
|
||||
|
||||
panel.activateControl(toolControl);
|
||||
t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active,
|
||||
"activated one tool control, the other one is inactive and the toggle control also.");
|
||||
|
||||
panel.activateControl(toggleControl);
|
||||
t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
|
||||
"activated the toggle control, which has no influence on the tool controls.");
|
||||
|
||||
panel.activateControl(anotherToolControl);
|
||||
t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
|
||||
"activated the other tool control, the first one is inactive and the toggle control still active.");
|
||||
}
|
||||
panel.activateControl(toolControl);
|
||||
t.ok(toolControl.active && !anotherToolControl.active && !toggleControl.active,
|
||||
"activated one tool control, the other one is inactive and the toggle control also.");
|
||||
|
||||
panel.activateControl(toggleControl);
|
||||
t.ok(toolControl.active && !anotherToolControl.active && toggleControl.active,
|
||||
"activated the toggle control, which has no influence on the tool controls.");
|
||||
|
||||
panel.activateControl(anotherToolControl);
|
||||
t.ok(!toolControl.active && anotherToolControl.active && toggleControl.active,
|
||||
"activated the other tool control, the first one is inactive and the toggle control still active.");
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user