summaryrefslogtreecommitdiff
path: root/misc/openlayers/tests/Protocol.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/Protocol.html
parent59741cd535c47f25971bf8c32b25da25ceadc6d5 (diff)
downloadpostrunner-0.0.4.zip
Adding jquery, flot and openlayers to be included with the GEM.v0.0.4
Diffstat (limited to 'misc/openlayers/tests/Protocol.html')
-rw-r--r--misc/openlayers/tests/Protocol.html63
1 files changed, 63 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Protocol.html b/misc/openlayers/tests/Protocol.html
new file mode 100644
index 0000000..7432b86
--- /dev/null
+++ b/misc/openlayers/tests/Protocol.html
@@ -0,0 +1,63 @@
+<html>
+<head>
+ <script src="OLLoader.js"></script>
+ <script type="text/javascript">
+
+ function test_initialize(t) {
+ t.plan(4);
+ var options = {};
+ var protocol = new OpenLayers.Protocol(options);
+
+ t.ok(protocol instanceof OpenLayers.Protocol,
+ "new OpenLayers.Protocol returns object" );
+ t.eq(protocol.options, options, "constructor sets this.options");
+ t.eq(protocol.options.filter, null, "constructor sets defaultFilter to null");
+ t.eq(protocol.autoDestroy, true, "constructor does not modify this.autoDestroy");
+ }
+
+ function test_read_defaultFilter(t) {
+ t.plan(4);
+
+ var protocol = new OpenLayers.Protocol({filter: "a"});
+ var options = {};
+ protocol.read(options);
+ // the line below is what happens in Protocol.WFS.v1::read
+ OpenLayers.Util.applyDefaults(options, protocol.options);
+ t.eq(options.filter, "a", "filter from protocol.options applied to options");
+ protocol.destroy();
+
+ var defaultFilter = 'a';
+ var options = {
+ defaultFilter: defaultFilter
+ };
+
+ protocol = new OpenLayers.Protocol(options);
+ var readFilter = 'b';
+ var options = { filter: readFilter };
+
+ protocol.read(options);
+
+ var filter = options.filter;
+ t.ok(filter instanceof OpenLayers.Filter.Logical, "read method merge default filter & options filter to a logical one");
+ t.eq(filter.type, OpenLayers.Filter.Logical.AND, "logical filter type is OpenLayers.Filter.Logical.AND");
+ t.eq(filter.filters, [defaultFilter, readFilter], "read method has merged filters");
+ protocol.destroy();
+ }
+
+ function test_destroy(t) {
+ t.plan(2);
+ var protocol = new OpenLayers.Protocol({
+ options: {foo: 'bar'},
+ format: 'foo'
+ });
+ protocol.destroy();
+
+ t.eq(protocol.format, null, "destroy nullify protocol.format");
+ t.eq(protocol.options, null, "destroy nullify protocol.options");
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>