Merge branch '2.12' of github.com:openlayers/openlayers
This commit is contained in:
@@ -135,7 +135,7 @@
|
||||
}
|
||||
|
||||
function test_createRequest(t) {
|
||||
t.plan(4);
|
||||
t.plan(6);
|
||||
var protocol = new OpenLayers.Protocol.Script({
|
||||
callbackKey: 'cb_key',
|
||||
callbackPrefix: 'cb_prefix:'
|
||||
@@ -150,15 +150,20 @@
|
||||
|
||||
t.eq(script.type, 'text/javascript',
|
||||
'created script has a correct type');
|
||||
t.eq(script.src, 'http://bar_url/?k=bar_param&cb_key=cb_prefix%3AOpenLayers.Protocol.Script.registry%5Bbar%5D',
|
||||
'created script has a correct url');
|
||||
|
||||
var params = OpenLayers.Util.getParameters(script.src);
|
||||
t.eq(params.k, "bar_param", "custom query string param");
|
||||
t.eq(params.cb_key, "cb_prefix:OpenLayers.Protocol.Script.registry.bar", "callback with prefix");
|
||||
|
||||
t.eq(script.id, 'OpenLayers_Protocol_Script_bar',
|
||||
'created script has a correct id');
|
||||
|
||||
protocol.callbackTemplate = "OpenLayers.Protocol.Script.registry.${id}";
|
||||
script = protocol.createRequest('http://bar_url/', {'k': 'bar_param'}, 'bar_callback');
|
||||
t.eq(script.src, 'http://bar_url/?k=bar_param&cb_key=cb_prefix%3AOpenLayers.Protocol.Script.registry.bar',
|
||||
'created script has a correct url with different template');
|
||||
protocol.callbackTemplate = "customCallback(${id})";
|
||||
script = protocol.createRequest('http://bar_url/', {'k': 'bar_param2'}, 'bar_callback');
|
||||
|
||||
params = OpenLayers.Util.getParameters(script.src);
|
||||
t.eq(params.k, "bar_param2", "custom query string param");
|
||||
t.eq(params.cb_key, "cb_prefix:customCallback(bar)", "custom callback with prefix");
|
||||
|
||||
OpenLayers.Protocol.Script.register = _register;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user