summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2017-05-04 18:23:15 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2017-05-08 13:59:41 +0300
commitc4c75165bee5a19eb77cef4ddd429805fa0c96f2 (patch)
tree9c0ed98572c611617c029d0974104a4c1d4a92bb
parent45545e15fc41d5beb98612736ee624272b192096 (diff)
downloadqtlocation-mapboxgl-c4c75165bee5a19eb77cef4ddd429805fa0c96f2.tar.gz
[node] Update the test suite to reflect changes on the node bindings
Set some of the map properties only via "render options". Setting them via methods was pretty a no-op anyway. Force debug parameters to be boolean.
-rw-r--r--platform/node/test/suite_implementation.js35
1 files changed, 23 insertions, 12 deletions
diff --git a/platform/node/test/suite_implementation.js b/platform/node/test/suite_implementation.js
index 8ac372b7c3..76e98dc929 100644
--- a/platform/node/test/suite_implementation.js
+++ b/platform/node/test/suite_implementation.js
@@ -36,9 +36,9 @@ module.exports = function (style, options, callback) {
}, 20000);
options.debug = {
- tileBorders: options.debug,
- collision: options.collisionDebug,
- overdraw: options.showOverdrawInspector,
+ tileBorders: !!options.debug,
+ collision: !!options.collisionDebug,
+ overdraw: !!options.showOverdrawInspector,
};
options.center = style.center || [0, 0];
@@ -82,17 +82,28 @@ module.exports = function (style, options, callback) {
applyOperations(operations.slice(1), callback);
} else {
// Ensure that the next `map.render(options)` does not overwrite this change.
- if (operation[0] === 'setCenter') {
- options.center = operation[1];
- } else if (operation[0] === 'setZoom') {
- options.zoom = operation[1];
- } else if (operation[0] === 'setBearing') {
- options.bearing = operation[1];
- } else if (operation[0] === 'setPitch') {
- options.pitch = operation[1];
+ var methods = ['setCenter', 'setZoom', 'setBearing', 'setPitch' ];
+ var index = methods.indexOf(operation[0]);
+
+ if (index >= 0) {
+ switch (index) {
+ case 0:
+ options.center = operation[1];
+ break;
+ case 1:
+ options.zoom = operation[1];
+ break;
+ case 2:
+ options.bearing = operation[1];
+ break;
+ case 3:
+ options.pitch = operation[1];
+ break;
+ }
+ } else {
+ map[operation[0]].apply(map, operation.slice(1));
}
- map[operation[0]].apply(map, operation.slice(1));
applyOperations(operations.slice(1), callback);
}
}