mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-30 17:27:44 +03:00
BREAKING CHANGE - Rename isChromiumBased
-> isChromeFamily
& isPWA
-> isStandalonePWA
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { expectType } from 'tsd';
|
||||
import { UAParser, IResult, IBrowser, ICPU, IEngine, IDevice, IOS } from "../src/main/ua-parser";
|
||||
import { isAppleSilicon, isChromiumBased } from "../src/helpers/ua-parser-helpers";
|
||||
import { isAppleSilicon, isChromeFamily } from "../src/helpers/ua-parser-helpers";
|
||||
|
||||
const uastring = 'Mozilla/5.0 (X11; MyCustomOS; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0';
|
||||
const extensions = {
|
||||
@@ -46,4 +46,4 @@ expectType<UAParser>(parser.setUA(uastring));
|
||||
const result = parser.getResult();
|
||||
|
||||
expectType<boolean>(isAppleSilicon(result));
|
||||
expectType<boolean>(isChromiumBased(result));
|
||||
expectType<boolean>(isChromeFamily(result));
|
@@ -1,6 +1,6 @@
|
||||
const assert = require('assert');
|
||||
const { UAParser } = require('../src/main/ua-parser');
|
||||
const { isAppleSilicon, isChromiumBased } = require('../src/helpers/ua-parser-helpers');
|
||||
const { isAppleSilicon, isChromeFamily } = require('../src/helpers/ua-parser-helpers');
|
||||
|
||||
describe('isAppleSilicon', () => {
|
||||
it('Can detect Apple Silicon device', () => {
|
||||
@@ -14,13 +14,13 @@ describe('isAppleSilicon', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isChromiumBased', () => {
|
||||
describe('isChromeFamily', () => {
|
||||
it('Can detect Chromium-based browser', () => {
|
||||
|
||||
const edge = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36 Edg/119.0.2151.58';
|
||||
const firefox = 'Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/111.0';
|
||||
|
||||
assert.equal(isChromiumBased(UAParser(edge)), true);
|
||||
assert.equal(isChromiumBased(UAParser(firefox)), false);
|
||||
assert.equal(isChromeFamily(UAParser(edge)), true);
|
||||
assert.equal(isChromeFamily(UAParser(firefox)), false);
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user