mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-30 17:27:44 +03:00
Update formFactor to be a list
This commit is contained in:
@@ -466,17 +466,26 @@ describe('Map UA-CH headers', function () {
|
||||
it('Can detect form-factor from client-hints', function () {
|
||||
|
||||
const FFVR = {
|
||||
'sec-ch-ua-form-factor' : 'VR'
|
||||
'sec-ch-ua-form-factor' : '"VR"'
|
||||
};
|
||||
|
||||
const FFEInk = {
|
||||
'sec-ch-ua-form-factor' : '"Tablet", "EInk"'
|
||||
};
|
||||
|
||||
const FFUnknown = {
|
||||
'sec-ch-ua-form-factor' : 'Unknown'
|
||||
'sec-ch-ua-form-factor' : '"Unknown"'
|
||||
};
|
||||
|
||||
UAParser(FFVR).withClientHints().then(function (ua) {
|
||||
assert.strictEqual(ua.device.type, 'wearable');
|
||||
});
|
||||
|
||||
UAParser(FFEInk).withClientHints().then(function (ua) {
|
||||
assert.strictEqual(ua.device.type, 'tablet');
|
||||
});
|
||||
|
||||
|
||||
UAParser(FFUnknown).withClientHints().then(function (ua) {
|
||||
assert.strictEqual(ua.device.type, undefined);
|
||||
});
|
||||
|
@@ -40,7 +40,8 @@ test('read client hints data', async ({ page }) => {
|
||||
version: '110'
|
||||
}
|
||||
],
|
||||
platform: 'New OS'
|
||||
platform: 'New OS',
|
||||
formFactor: 'New Form Factor'
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -54,6 +55,7 @@ test('read client hints data', async ({ page }) => {
|
||||
|
||||
expect(uap).toHaveProperty('browser.name', 'New Browser');
|
||||
expect(uap).toHaveProperty('os.name', 'New OS');
|
||||
expect(uap).toHaveProperty('device.type', undefined);
|
||||
});
|
||||
|
||||
test('detect Brave', async ({ page }) => {
|
||||
|
Reference in New Issue
Block a user