mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Fixes, refactor, new test cases
This commit is contained in:
parent
b2b36e6adb
commit
496136fd83
26
src/utils.js
26
src/utils.js
@ -77,18 +77,20 @@ export default class Utils {
|
||||
const v = version.split('.').splice(0, 2).map(s => parseInt(s, 10) || 0);
|
||||
v.push(0);
|
||||
if (v[0] !== 10) return undefined;
|
||||
if (v[1] === 5) return 'Leopard';
|
||||
if (v[1] === 6) return 'Snow Leopard';
|
||||
if (v[1] === 7) return 'Lion';
|
||||
if (v[1] === 8) return 'Mountain Lion';
|
||||
if (v[1] === 9) return 'Mavericks';
|
||||
if (v[1] === 10) return 'Yosemite';
|
||||
if (v[1] === 11) return 'El Capitan';
|
||||
if (v[1] === 12) return 'Sierra';
|
||||
if (v[1] === 13) return 'High Sierra';
|
||||
if (v[1] === 14) return 'Mojave';
|
||||
if (v[1] === 15) return 'Catalina';
|
||||
return undefined;
|
||||
switch (v[1]) {
|
||||
case 5: return 'Leopard';
|
||||
case 6: return 'Snow Leopard';
|
||||
case 7: return 'Lion';
|
||||
case 8: return 'Mountain Lion';
|
||||
case 9: return 'Mavericks';
|
||||
case 10: return 'Yosemite';
|
||||
case 11: return 'El Capitan';
|
||||
case 12: return 'Sierra';
|
||||
case 13: return 'High Sierra';
|
||||
case 14: return 'Mojave';
|
||||
case 15: return 'Catalina';
|
||||
default: return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -207,6 +207,21 @@
|
||||
type: "desktop"
|
||||
engine:
|
||||
name: "Blink"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"
|
||||
spec:
|
||||
browser:
|
||||
name: "Chrome"
|
||||
version: "49.0.2623.112"
|
||||
os:
|
||||
name: "macOS"
|
||||
version: "10.7.5"
|
||||
versionName: "Lion"
|
||||
platform:
|
||||
type: "desktop"
|
||||
vendor: "Apple"
|
||||
engine:
|
||||
name: "Blink"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24"
|
||||
spec:
|
||||
@ -797,6 +812,22 @@
|
||||
engine:
|
||||
name: "WebKit"
|
||||
version: "531.21.10"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A"
|
||||
spec:
|
||||
browser:
|
||||
name: "Safari"
|
||||
version: "7.0.3"
|
||||
os:
|
||||
name: "macOS"
|
||||
version: "10.9.3"
|
||||
versionName: "Mavericks"
|
||||
platform:
|
||||
type: "desktop"
|
||||
vendor: "Apple"
|
||||
engine:
|
||||
name: "WebKit"
|
||||
version: "537.75.14"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_7; de-de) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.28.3"
|
||||
spec:
|
||||
@ -876,6 +907,22 @@
|
||||
engine:
|
||||
name: "WebKit"
|
||||
version: "532.9"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13) AppleWebKit/604.1.31 (KHTML, like Gecko) Version/11.0 Safari/604.1.31"
|
||||
spec:
|
||||
browser:
|
||||
name: "Safari"
|
||||
version: "11.0"
|
||||
os:
|
||||
name: "macOS"
|
||||
version: "10.13"
|
||||
versionName: "High Sierra"
|
||||
platform:
|
||||
type: "desktop"
|
||||
vendor: "Apple"
|
||||
engine:
|
||||
name: "WebKit"
|
||||
version: "604.1.31"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_2; en-gb) AppleWebKit/526+ (KHTML, like Gecko) Version/3.1 iPhone"
|
||||
spec:
|
||||
@ -2098,6 +2145,21 @@
|
||||
engine:
|
||||
name: "WebKit"
|
||||
version: "533.1"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; U; Android 2.2; en-us; GT-I5800 Build/FROYO) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
|
||||
spec:
|
||||
browser:
|
||||
name: "Android Browser"
|
||||
version: "4.0"
|
||||
os:
|
||||
name: "Android"
|
||||
version: "2.2"
|
||||
versionName: "Froyo"
|
||||
platform:
|
||||
type: "mobile"
|
||||
engine:
|
||||
name: "WebKit"
|
||||
version: "533.1"
|
||||
-
|
||||
ua: "Mozilla/5.0 (Linux; U; Android 1.6; ar-us; SonyEricssonX10i Build/R2BA026) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1"
|
||||
spec:
|
||||
|
@ -20,13 +20,16 @@ test('getWindowsVersionName', (t) => {
|
||||
|
||||
test('getMacOSVersionName', (t) => {
|
||||
t.is(getMacOSVersionName('10.14.5'), 'Mojave');
|
||||
t.is(getMacOSVersionName('10.15'), 'Catalina');
|
||||
t.is(getMacOSVersionName('10.999999'), void 0);
|
||||
t.is(getMacOSVersionName('XXX'), void 0);
|
||||
});
|
||||
|
||||
test('getAndroidVersionName', (t) => {
|
||||
t.is(getAndroidVersionName('1.0'), void 0);
|
||||
t.is(getAndroidVersionName('8.0'), 'Oreo');
|
||||
t.is(getAndroidVersionName('9'), 'Pie');
|
||||
t.is(getWindowsVersionName('XXX'), void 0);
|
||||
t.is(getAndroidVersionName('XXX'), void 0);
|
||||
});
|
||||
|
||||
test('compareVersions', (t) => {
|
||||
|
Loading…
Reference in New Issue
Block a user