diff --git a/lib/OpenLayers/Protocol/Script.js b/lib/OpenLayers/Protocol/Script.js index 5cba843e9b..4ef847494e 100644 --- a/lib/OpenLayers/Protocol/Script.js +++ b/lib/OpenLayers/Protocol/Script.js @@ -57,9 +57,9 @@ OpenLayers.Protocol.Script = OpenLayers.Class(OpenLayers.Protocol, { * APIProperty: callbackTemplate * {String} Template for creating a unique callback function name * for the registry. Should include ${id}. - * Default is "OpenLayers.Protocol.Script.registry[${id}]". + * Default is "OpenLayers.Protocol.Script.registry['${id}']". */ - callbackTemplate: "OpenLayers.Protocol.Script.registry[${id}]", + callbackTemplate: "OpenLayers.Protocol.Script.registry['${id}']", /** * APIProperty: callbackKey diff --git a/tests/Protocol/Script.html b/tests/Protocol/Script.html index ee8ac89018..3a0b9b610f 100644 --- a/tests/Protocol/Script.html +++ b/tests/Protocol/Script.html @@ -135,7 +135,7 @@ } function test_createRequest(t) { - t.plan(4); + t.plan(5); var protocol = new OpenLayers.Protocol.Script({ callbackKey: 'cb_key', callbackPrefix: 'cb_prefix:' @@ -150,8 +150,11 @@ 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');