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