diff --git a/NEWS b/NEWS index df59b7f..b8d5e44 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ -2.6.2 +2.7.1 - Fix renderer not rendering marker-lines +2.7.0 + - Adds option to not fetch map when instantiating a windshaft provider (#74) + 2.6.1 - Fix marker fill opacity (#72) diff --git a/lib/torque/provider/windshaft.js b/lib/torque/provider/windshaft.js index e34c98d..14b7808 100644 --- a/lib/torque/provider/windshaft.js +++ b/lib/torque/provider/windshaft.js @@ -33,8 +33,9 @@ var e = this.options.extra_params || (this.options.extra_params = {}); e.auth_token = this.options.auth_token; } - - this._fetchMap(); + if (!this.options.no_fetch_map) { + this._fetchMap(); + } }; json.prototype = { diff --git a/package.json b/package.json index 31635e0..3bd5d9f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "torque.js", - "version": "2.6.2", + "version": "2.7.1", "description": "Torque javascript library", "repository": { "type": "git", diff --git a/test/provider.windshaft.test.js b/test/provider.windshaft.test.js index 2491b8d..b2a35e3 100644 --- a/test/provider.windshaft.test.js +++ b/test/provider.windshaft.test.js @@ -135,4 +135,30 @@ test("auth_token with several params as array param and present in url", functio ok(lastCall.indexOf("auth_token[]=token2") !== -1); }); +[ + { shouldInvokeFetchMap: true, desc: 'undefined no_fetch_map option provided should invoke _fetchMap' }, + { no_fetch_map: false, shouldInvokeFetchMap: true, desc: 'no_fetch_map=false should invoke _fetchMap' }, + { no_fetch_map: true, shouldInvokeFetchMap: false, desc: 'no_fetch_map=true should NOT invoke _fetchMap' } +].forEach(function(fetchMapCase) { + + test("no_fetch_map option: " + fetchMapCase.desc, function() { + var fetchMapFn = torque.providers.windshaft.prototype._fetchMap; + + var _fetchMapInvoked = false; + torque.providers.windshaft.prototype._fetchMap = function() { + _fetchMapInvoked = true; + }; + + new torque.providers.windshaft({ + table: 'test', + user: "rambo", + no_fetch_map: fetchMapCase.no_fetch_map + }); + + equal(_fetchMapInvoked, fetchMapCase.shouldInvokeFetchMap); + + torque.providers.windshaft.prototype._fetchMap = fetchMapFn; + }); + +});