Adds option to not fetch map when instantiating a windshaft provider.
Closes #74
This commit is contained in:
parent
20b88a72ff
commit
9c5c290c4e
3
NEWS
3
NEWS
@ -1,3 +1,6 @@
|
||||
2.7.0
|
||||
- Adds option to not fetch map when instantiating a windshaft provider (#74)
|
||||
|
||||
2.6.1
|
||||
- Fix marker fill opacity (#72)
|
||||
|
||||
|
@ -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 = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "torque.js",
|
||||
"version": "2.6.1",
|
||||
"version": "2.7.0",
|
||||
"description": "Torque javascript library",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -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;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user