Tests for response property on loadend event.

This confirms that the loadend event includes a response property when it results from a call to the strategy merge method (see #624).
This commit is contained in:
tschaub
2012-08-08 11:41:51 -06:00
parent 7e326f97e2
commit 970448effc
2 changed files with 11 additions and 5 deletions

View File

@@ -112,16 +112,18 @@
function test_events(t) {
t.plan(5);
t.plan(6);
var log = [];
var response = new OpenLayers.Protocol.Response();
var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.Vector(null, {
strategies: [new OpenLayers.Strategy.BBOX()],
protocol: new OpenLayers.Protocol({
read: function(config) {
config.callback.call(config.scope, {});
config.callback.call(config.scope, response);
}
}),
isBaseLayer: true,
@@ -140,6 +142,7 @@
t.eq(log.length, 2, "2 events logged");
t.eq(log[0].type, "loadstart", "loadstart first");
t.eq(log[1].type, "loadend", "loadend second");
t.ok(log[1].response == response, "loadend includes response");
var calls = [];
layer.protocol.read = function(obj) {

View File

@@ -62,16 +62,18 @@
function test_events(t) {
t.plan(5);
t.plan(6);
var log = [];
var response = new OpenLayers.Protocol.Response();
var map = new OpenLayers.Map("map");
var layer = new OpenLayers.Layer.Vector(null, {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol({
read: function(config) {
config.callback.call(config.scope, {});
config.callback.call(config.scope, response);
}
}),
isBaseLayer: true,
@@ -87,10 +89,11 @@
map.addLayer(layer);
map.zoomToMaxExtent();
t.eq(log.length, 2, "2 events logged");
t.eq(log[0].type, "loadstart", "loadstart first");
t.eq(log[1].type, "loadend", "loadend second");
t.ok(log[1].response == response, "loadend includes response");
var calls = [];
layer.protocol.read = function(obj) {