Throw an error when minVersion map has not a string as a browser version

fixes #165
pull/170/head
Denis Demchenko 8 years ago
parent 533afc8fec
commit 8b92707e7b

@ -540,6 +540,10 @@
for (var browser in minVersions) {
if (minVersions.hasOwnProperty(browser)) {
if (_bowser[browser]) {
if (typeof minVersions[browser] !== 'string') {
throw new Error('Browser version in the minVersion map should be a string: ' + browser + ': ' + String(minVersions));
}
// browser version and min supported version.
return compareVersions([version, minVersions[browser]]) < 0;
}

@ -127,6 +127,12 @@ describe('Unsupported browser check', function() {
assert.equal(supported, false);
});
it('should throw an error when minVersion map has a number, but not a string', function() {
assert.throws(() => {
browser.check({msie: 11}, this.ie10_6);
}, /Browser version in the minVersion map should be a string/);
});
it('should be passed by #check for IE10.6 when version was not specified', function() {
var supported = browser.check({}, this.ie10_6);
assert.equal(supported, true);

Loading…
Cancel
Save