From 21d06b092a738e13117f4d56361fe393a0c00ae0 Mon Sep 17 00:00:00 2001 From: Peter Robins Date: Thu, 9 Feb 2012 15:58:41 +0000 Subject: [PATCH] Protocol/Script: add test for callbackTemplate --- tests/Protocol/Script.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/Protocol/Script.html b/tests/Protocol/Script.html index a676e61821..ee8ac89018 100644 --- a/tests/Protocol/Script.html +++ b/tests/Protocol/Script.html @@ -135,7 +135,7 @@ } function test_createRequest(t) { - t.plan(3); + t.plan(4); var protocol = new OpenLayers.Protocol.Script({ callbackKey: 'cb_key', callbackPrefix: 'cb_prefix:' @@ -155,7 +155,13 @@ 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'); + OpenLayers.Protocol.Script.register = _register; + } function test_destroyRequest(t) {