allow protocols to be configured with a default filter, p=aabt, r=me (closes #2292)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9702 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
+21
-1
@@ -4,16 +4,36 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
function test_initialize(t) {
|
||||
t.plan(3);
|
||||
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(3);
|
||||
var defaultFilter = 'a';
|
||||
var options = {
|
||||
defaultFilter: defaultFilter
|
||||
};
|
||||
|
||||
var 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");
|
||||
}
|
||||
|
||||
function test_destroy(t) {
|
||||
t.plan(2);
|
||||
var protocol = new OpenLayers.Protocol({
|
||||
|
||||
Reference in New Issue
Block a user