mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-27 22:11:38 +01:00
restore opr and safari on window
This commit is contained in:
parent
5510f1b560
commit
4993d4b00d
@ -33,12 +33,20 @@ describe('Browser Utils Service', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('getBrowser', () => {
|
describe('getBrowser', () => {
|
||||||
const original = navigator.userAgent;
|
const originalUserAgent = navigator.userAgent;
|
||||||
|
const originalSafari = (window as any).safari;
|
||||||
|
const originalOpr = (window as any).opr;
|
||||||
|
|
||||||
// Reset the userAgent.
|
// Reset the userAgent.
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
Object.defineProperty(navigator, 'userAgent', {
|
Object.defineProperty(navigator, 'userAgent', {
|
||||||
value: original
|
value: originalUserAgent
|
||||||
|
});
|
||||||
|
Object.defineProperty(window, 'safari', {
|
||||||
|
value: originalSafari
|
||||||
|
});
|
||||||
|
Object.defineProperty(window, 'opr', {
|
||||||
|
value: originalOpr
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -67,6 +75,11 @@ describe('Browser Utils Service', () => {
|
|||||||
configurable: true,
|
configurable: true,
|
||||||
value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3175.3 Safari/537.36 OPR/49.0.2695.0 (Edition developer)'
|
value: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3175.3 Safari/537.36 OPR/49.0.2695.0 (Edition developer)'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Object.defineProperty(window, 'opr', {
|
||||||
|
configurable: true,
|
||||||
|
value: {}
|
||||||
|
});
|
||||||
|
|
||||||
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
const browserPlatformUtilsService = new BrowserPlatformUtilsService(null);
|
||||||
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Opera);
|
expect(browserPlatformUtilsService.getDevice()).toBe(DeviceType.Opera);
|
||||||
|
Loading…
Reference in New Issue
Block a user