Move detection of map procjection to merge function, check for successful response and fix tests.
This commit is contained in:
@@ -10,7 +10,10 @@
|
||||
// a fake protocol
|
||||
var protocol = {
|
||||
read: function(options) {
|
||||
options.callback.call(options.scope, {features: featureList});
|
||||
options.callback.call(options.scope, {
|
||||
features: featureList,
|
||||
success: OpenLayers.Function.True
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -162,7 +165,7 @@
|
||||
];
|
||||
|
||||
// call merge with a mocked up response
|
||||
strategy.merge(new OpenLayers.Projection("EPSG:900913"), {features: features});
|
||||
strategy.merge({features: features, success: OpenLayers.Function.True});
|
||||
|
||||
// confirm that the original features were destroyed
|
||||
t.eq(layer.features.length, 2, "old features destroyed");
|
||||
@@ -186,7 +189,7 @@
|
||||
];
|
||||
|
||||
// call merge again with mocked up response
|
||||
strategy.merge(new OpenLayers.Projection("EPSG:900913"), {features: features});
|
||||
strategy.merge({features: features, success: OpenLayers.Function.True});
|
||||
|
||||
// test that feature geometries have not been transformed
|
||||
t.geom_eq(layer.features[0].geometry, features[0].geometry, "[same proj] feature 0 geometry not transformed");
|
||||
@@ -195,7 +198,7 @@
|
||||
}
|
||||
|
||||
function test_load(t) {
|
||||
t.plan(4);
|
||||
t.plan(3);
|
||||
|
||||
// set up
|
||||
|
||||
@@ -210,8 +213,8 @@
|
||||
var response = new OpenLayers.Protocol.Response();
|
||||
|
||||
var strategy = new OpenLayers.Strategy.Fixed({
|
||||
merge: function(p, r) {
|
||||
log = {scope: this, projection: p, response: r};
|
||||
merge: function(r) {
|
||||
log = {scope: this, response: r};
|
||||
}
|
||||
});
|
||||
|
||||
@@ -235,8 +238,6 @@
|
||||
"merge was called");
|
||||
t.ok(log.scope == strategy,
|
||||
"merge called with expected scope");
|
||||
t.eq(log.projection.getCode(), map.getProjectionObject().getCode(),
|
||||
"merge called the map projection as the first arg");
|
||||
t.ok(log.response == response,
|
||||
"merge called with response as the first arg");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user