git-svn-id: http://svn.openlayers.org/trunk/openlayers@6106 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
71 lines
2.2 KiB
HTML
71 lines
2.2 KiB
HTML
<html>
|
|
<head>
|
|
<script src="../../lib/OpenLayers.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
function test_Control_Navigation_constructor (t) {
|
|
t.plan( 2 );
|
|
var temp = OpenLayers.Control.prototype.initialize;
|
|
OpenLayers.Control.prototype.initialize = function() {
|
|
t.ok(true, "OpenLayers.Control's constructor called");
|
|
};
|
|
|
|
var control = new OpenLayers.Control.Navigation();
|
|
t.ok( control instanceof OpenLayers.Control.Navigation, "new OpenLayers.Control returns object" );
|
|
|
|
OpenLayers.Control.prototype.initialize = temp;
|
|
}
|
|
|
|
function test_Control_Navigation_destroy (t) {
|
|
t.plan(9);
|
|
|
|
var temp = OpenLayers.Control.prototype.destroy;
|
|
OpenLayers.Control.prototype.destroy = function() {
|
|
t.ok(true, "OpenLayers.Control's destroy called");
|
|
temp.call(this);
|
|
};
|
|
|
|
var control = {
|
|
'deactivate': function() {
|
|
t.ok(true, "navigation control deactivated before being destroyed");
|
|
},
|
|
'dragPan': {
|
|
'destroy': function() {
|
|
t.ok(true, "dragPan destroyed");
|
|
}
|
|
},
|
|
'zoomBox': {
|
|
'destroy': function() {
|
|
t.ok(true, "zoomBox destroyed");
|
|
}
|
|
},
|
|
handlers: {
|
|
'wheel': {
|
|
'destroy': function() {
|
|
t.ok(true, "wheelHandler destroyed");
|
|
}
|
|
},
|
|
'click': {
|
|
'destroy': function() {
|
|
t.ok(true, "clickHandler destroyed");
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
//this will also trigger one test by calling OpenLayers.Control's destroy
|
|
// and three more for the destruction of dragPan, zoomBox, and wheelHandler
|
|
OpenLayers.Control.Navigation.prototype.destroy.apply(control, []);
|
|
|
|
t.eq(control.dragPan, null, "'dragPan' set to null");
|
|
t.eq(control.zoomBox, null, "'zoomBox' set to null");
|
|
t.eq(control.handlers, null, "handlers set to null");
|
|
|
|
OpenLayers.Control.prototype.destroy = temp;
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
</body>
|
|
</html> |