UNPKG

@enact/webos

Version:

webOS support library

90 lines (89 loc) 3.86 kB
"use strict"; var _platform = require("../platform"); describe('platform', function () { describe('parseUserAgent for webOS', function () { // From http://webostv.developer.lge.com/discover/specifications/web-engine/ var webOSTV1 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.41 (KHTML, like Gecko) Large Screen WebAppManager Safari/537.41'; var webOSTV2 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen WebAppManager Safari/538.2'; var webOSTV3 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.2.1 Chrome/38.0.2125.122 Safari/537.36 WebAppManager'; var webOSTV4 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.34 Safari/537.36 WebAppManager'; var webOSTV5 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 WebAppManager'; var webOSTV6 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36 WebAppManager'; var webOSTV22 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36 WebAppManager'; var webOSTV23 = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.128 Safari/537.36 WebAppManager'; var webOSTVChrome = 'Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 WebAppManager'; var webOSOther = 'Mozilla/5.0 (Web0S; Linux) AppleWebKit/537.36 (KHTML, like Gecko) Safari/537.36 WebAppManager'; test('should detect webOS 1', function () { var expected = { version: 1 }; var actual = (0, _platform.parseUserAgent)(webOSTV1); expect(actual).toMatchObject(expected); }); test('should detect webOS 2', function () { var expected = { version: 2 }; var actual = (0, _platform.parseUserAgent)(webOSTV2); expect(actual).toMatchObject(expected); }); test('should detect webOS 3', function () { var expected = { version: 3 }; var actual = (0, _platform.parseUserAgent)(webOSTV3); expect(actual).toMatchObject(expected); }); test('should detect webOS 4', function () { var expected = { version: 4 }; var actual = (0, _platform.parseUserAgent)(webOSTV4); expect(actual).toMatchObject(expected); }); test('should detect webOS 5', function () { var expected = { version: 5 }; var actual = (0, _platform.parseUserAgent)(webOSTV5); expect(actual).toMatchObject(expected); }); test('should detect webOS 6', function () { var expected = { version: 6 }; var actual = (0, _platform.parseUserAgent)(webOSTV6); expect(actual).toMatchObject(expected); }); test('should detect webOS 22', function () { var expected = { version: 22, chrome: 87 }; var actual = (0, _platform.parseUserAgent)(webOSTV22); expect(actual).toMatchObject(expected); }); test('should detect webOS 23', function () { var expected = { version: 23, chrome: 94 }; var actual = (0, _platform.parseUserAgent)(webOSTV23); expect(actual).toMatchObject(expected); }); test('should detect webOS with Chrome', function () { var expected = { chrome: 108 }; var actual = (0, _platform.parseUserAgent)(webOSTVChrome); expect(actual).toMatchObject(expected); }); test('should detect webOS without Chrome', function () { var expected = { open: true }; var actual = (0, _platform.parseUserAgent)(webOSOther); expect(actual).toMatchObject(expected); }); }); });