summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Strategy.html
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:56:44 +0200
commitea346a785dc1b3f7c156f6fc33da634e1f1a627b (patch)
treeaf67530553d20b6e82ad60fd79593e9c4abf5565 /misc/openlayers/tests/Strategy.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-fb1989bda5d3e0a5472ba7644d57cae197733a8f.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Strategy.html')
-rw-r--r--misc/openlayers/tests/Strategy.html94
1 files changed, 94 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Strategy.html b/misc/openlayers/tests/Strategy.html
new file mode 100644
index 0000000..5ecdef6
--- /dev/null
+++ b/misc/openlayers/tests/Strategy.html
@@ -0,0 +1,94 @@
+<html>
+<head>
+ <script src="OLLoader.js"></script>
+ <script type="text/javascript">
+
+ function test_initialize(t) {
+ t.plan(5);
+ 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");
+ t.eq(strategy.active, false, "constructor sets this.active to false");
+ t.eq(strategy.autoActivate, true, "constructor does not modify this.autoActivate");
+ t.eq(strategy.autoDestroy, true, "constructor does not modify this.autoDestroy");
+ }
+
+ 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");
+ }
+
+ function test_activate(t) {
+ t.plan(4);
+ var strategy = new OpenLayers.Strategy({
+ layer: 'foo'
+ });
+
+ var ret;
+ ret = strategy.activate();
+
+ t.eq(strategy.active, true, "activate sets this.active to true on first call");
+ t.eq(ret, true, "activate returns true on first call");
+
+ ret = strategy.activate();
+
+ t.eq(strategy.active, true, "activate does not modify this.active on second call");
+ t.eq(ret, false, "activate returns false on second call");
+ }
+
+ function test_deactivate(t) {
+ t.plan(4);
+ var strategy = new OpenLayers.Strategy({
+ layer: 'foo'
+ });
+ strategy.activate();
+
+ var ret;
+ ret = strategy.deactivate();
+
+ t.eq(strategy.active, false, "deactivate sets this.active to false on first call");
+ t.eq(ret, true, "deactivate returns true on first call");
+
+ ret = strategy.deactivate();
+
+ t.eq(strategy.active, false, "deactivate does not modify this.active on second call");
+ t.eq(ret, false, "deactivate returns false on second call");
+ }
+
+ </script>
+</head>
+<body>
+ <div id="map"/>
+</body>
+</html>