Files
openlayers/tests/Strategy.html
Frédéric Junod 4be8c169d4 test Strategy.activate and Strategy.deactivate
git-svn-id: http://svn.openlayers.org/trunk/openlayers@7706 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2008-08-05 11:44:36 +00:00

55 lines
1.4 KiB
HTML

<html>
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
function test_initialize(t) {
t.plan(2);
var options = {};
var strategy = new OpenLayers.Strategy(options);
t.ok(strategy instanceof OpenLayers.Strategy,
"new OpenLayers.Strategy returns object" );
t.eq(strategy.options, options, "constructor sets this.options");
}
function test_activate(t) {
t.plan(1);
var options = {
activate: function() {
t.ok(true, "OpenLayer.Map.addLayer calls activate");
}
};
var layer = new OpenLayers.Layer.Vector("Vector Layer", {
strategies: [new OpenLayers.Strategy(options)]
});
var map = new OpenLayers.Map('map');
map.addLayer(layer);
}
function test_destroy(t) {
t.plan(3);
var strategy = new OpenLayers.Strategy({
deactivate: function() {
t.ok(true, "destroy calls deactivate");
},
options: {foo: 'bar'},
layer: 'foo'
});
strategy.destroy();
t.eq(strategy.layer, null, "destroy nullify protocol.layer");
t.eq(strategy.options, null, "destroy nullify protocol.options");
}
</script>
</head>
<body>
<div id="map"/>
</body>
</html>