mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-10-01 01:37:43 +03:00
Improve device.type
detection using client hints "form-factor" data
This commit is contained in:
@@ -462,4 +462,23 @@ describe('Map UA-CH headers', function () {
|
||||
assert.strictEqual(ua.device.is("tablet"), false);
|
||||
});
|
||||
});
|
||||
|
||||
it('Can detect form-factor from client-hints', function () {
|
||||
|
||||
const FFVR = {
|
||||
'sec-ch-ua-form-factor' : 'VR'
|
||||
};
|
||||
|
||||
const FFUnknown = {
|
||||
'sec-ch-ua-form-factor' : 'Unknown'
|
||||
};
|
||||
|
||||
UAParser(FFVR).withClientHints().then(function (ua) {
|
||||
assert.strictEqual(ua.device.type, 'wearable');
|
||||
});
|
||||
|
||||
UAParser(FFUnknown).withClientHints().then(function (ua) {
|
||||
assert.strictEqual(ua.device.type, undefined);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user