From b1b47363154874e5d6cff2d89f00dfb789ecc36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 4 Apr 2012 20:30:50 +0200 Subject: [PATCH 1/2] make _getScriptLocation RegExp more robust, p=jpfiset, t,r=me --- lib/OpenLayers/SingleFile.js | 2 +- tests/SingleFile1.html | 4 ++-- tests/SingleFile2.html | 4 ++-- tests/SingleFile3.html | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/OpenLayers/SingleFile.js b/lib/OpenLayers/SingleFile.js index eeda78eef0..6bd4cb8e0f 100644 --- a/lib/OpenLayers/SingleFile.js +++ b/lib/OpenLayers/SingleFile.js @@ -25,7 +25,7 @@ var OpenLayers = { * {String} Path to this script */ _getScriptLocation: (function() { - var r = new RegExp("(^|(.*?\\/))(OpenLayers.*?\\.js)(\\?|$)"), + var r = new RegExp("(^|(.*?\\/))(OpenLayers[^\\/]*?\\.js)(\\?|$)"), s = document.getElementsByTagName('script'), src, m, l = ""; for(var i=0, len=s.length; i - + diff --git a/tests/SingleFile2.html b/tests/SingleFile2.html index 5fc9248058..68b47a3f9b 100644 --- a/tests/SingleFile2.html +++ b/tests/SingleFile2.html @@ -1,11 +1,11 @@ - + diff --git a/tests/SingleFile3.html b/tests/SingleFile3.html index 557952c233..bb58fcbde8 100644 --- a/tests/SingleFile3.html +++ b/tests/SingleFile3.html @@ -1,11 +1,11 @@ - + From 59cc18d85b672c4c426fcff04192abb9bf19bde5 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Tue, 10 Apr 2012 14:31:20 +0200 Subject: [PATCH 2/2] fix Bing attribution issue reported by PitneyBowes --- lib/OpenLayers/Layer/Bing.js | 3 ++- tests/Layer/Bing.html | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/OpenLayers/Layer/Bing.js b/lib/OpenLayers/Layer/Bing.js index 8304fbe5b4..30bb412550 100644 --- a/lib/OpenLayers/Layer/Bing.js +++ b/lib/OpenLayers/Layer/Bing.js @@ -229,7 +229,8 @@ OpenLayers.Layer.Bing = OpenLayers.Class(OpenLayers.Layer.XYZ, { provider = providers[i]; for (j=0,jj=provider.coverageAreas.length; j= coverage.zoomMin) { copyrights += provider.attribution + " "; diff --git a/tests/Layer/Bing.html b/tests/Layer/Bing.html index 8bb5016dd8..a55d2ebb24 100644 --- a/tests/Layer/Bing.html +++ b/tests/Layer/Bing.html @@ -98,6 +98,25 @@ map.destroy(); }); } + + function test_attribution_notempty(t) { + t.plan(1); + + var log = []; + var map = new OpenLayers.Map("map"); + layer = new OpenLayers.Layer.Bing(OpenLayers.Util.applyDefaults({type: 'Road'}, options)); + map.addLayer(layer); + var format = OpenLayers.String.format; + OpenLayers.String.format = function(tpl, options) { + log.push(options.copyrights); + } + map.zoomToExtent(new OpenLayers.Bounds(-14768652, 4492113, -12263964, 5744457)); + t.delay_call(2, function() { + t.ok(log.join("") !== "", "Copyright not empty"); + OpenLayers.String.format = format; + map.destroy(); + }); + } function test_getXYZ(t) { t.plan(1);