Update formFactor to be a list

This commit is contained in:
Faisal Salman
2023-09-30 15:42:18 +07:00
parent a9247154e0
commit f6fbf170e3
3 changed files with 39 additions and 15 deletions

View File

@@ -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);
});

View File

@@ -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 }) => {