mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge branch 'fix-strict-mode' of https://github.com/nirrattner/bowser into nirrattner-fix-strict-mode
This commit is contained in:
commit
93f2fa0a0f
@ -524,9 +524,7 @@
|
||||
if (minVersions.hasOwnProperty(browser)) {
|
||||
if (_bowser[browser]) {
|
||||
// browser version and min supported version.
|
||||
if (compareVersions([version, minVersions[browser]]) < 0) {
|
||||
return true; // unsupported
|
||||
}
|
||||
return compareVersions([version, minVersions[browser]]) < 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -540,8 +538,8 @@
|
||||
* @param {Boolean} [strictMode = false] flag to return false if browser wasn't found in map
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function check(minVersions, strictMode) {
|
||||
return !isUnsupportedBrowser(minVersions, strictMode);
|
||||
function check(minVersions, strictMode, ua) {
|
||||
return !isUnsupportedBrowser(minVersions, strictMode, ua);
|
||||
}
|
||||
|
||||
bowser.isUnsupportedBrowser = isUnsupportedBrowser;
|
||||
|
10
test/test.js
10
test/test.js
@ -112,11 +112,21 @@ describe('Unsupported browser check', function() {
|
||||
assert.equal(unsupported, false);
|
||||
});
|
||||
|
||||
it('should be passed by #isUnsupportedBrowser for IE10.6 and for IE10 miminal version specified in strict mode', function() {
|
||||
var unsupported = browser.isUnsupportedBrowser({msie: "10"}, true, this.ie10_6);
|
||||
assert.equal(unsupported, false);
|
||||
});
|
||||
|
||||
it('should NOT be passed by #check for IE10.6 and for IE11 miminal version specified', function() {
|
||||
var supported = browser.check({msie: "11"}, this.ie10_6);
|
||||
assert.equal(supported, false);
|
||||
});
|
||||
|
||||
it('should NOT be passed by #check for IE10.6 and for IE11 miminal version specified in strict mode', function() {
|
||||
var supported = browser.check({msie: "11"}, true, this.ie10_6);
|
||||
assert.equal(supported, false);
|
||||
});
|
||||
|
||||
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…
Reference in New Issue
Block a user