diff options
author | Mike Morris <michael.patrick.morris@gmail.com> | 2015-11-04 18:18:08 -0500 |
---|---|---|
committer | Mike Morris <michael.patrick.morris@gmail.com> | 2015-11-04 18:18:08 -0500 |
commit | 5e58070decb7ee5e1538a120e6b8261a0574d334 (patch) | |
tree | 00108695a53e84161fce5ecc927c30f6000f58a1 /platform/node/test/js/map.test.js | |
parent | 3528002b580f9e5ae19ef4df7543e913c5d27ab4 (diff) | |
download | qtlocation-mapboxgl-5e58070decb7ee5e1538a120e6b8261a0574d334.tar.gz |
[node] make ratio optional, default to 1.0
Diffstat (limited to 'platform/node/test/js/map.test.js')
-rw-r--r-- | platform/node/test/js/map.test.js | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js index a87f4aac1a..0ccaa4b55e 100644 --- a/platform/node/test/js/map.test.js +++ b/platform/node/test/js/map.test.js @@ -27,7 +27,7 @@ test('Map', function(t) { t.end(); }); - t.test('requires request and ratio options', function(t) { + t.test('requires request property', function(t) { var options = {}; t.throws(function() { @@ -40,20 +40,41 @@ test('Map', function(t) { }, /Options object must have a 'request' method/); options.request = function() {}; + t.doesNotThrow(function() { + new mbgl.Map(options); + }); + + t.end(); + }); + + t.test('optional cancel property must be a function', function(t) { + var options = { + request: function() {} + }; + options.cancel = 'test'; t.throws(function() { new mbgl.Map(options); }, /Options object 'cancel' property must be a function/); options.cancel = function() {}; - t.throws(function() { + t.doesNotThrow(function() { new mbgl.Map(options); - }, /Options object must have a numerical 'ratio' property/); + }); + + t.end(); + }); + + + t.test('optional ratio property must be a number', function(t) { + var options = { + request: function() {} + }; options.ratio = 'test'; t.throws(function() { new mbgl.Map(options); - }, /Options object must have a numerical 'ratio' property/); + }, /Options object 'ratio' property must be a number/); options.ratio = 1.0; t.doesNotThrow(function() { |