mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
[PM-5880] Refactor browser platform utils service to remove window references (#7885)
* [PM-5880] Refactor Browser Platform Utils Service to Remove Window Service * [PM-5880] Implementing BrowserClipboardService to handle clipboard logic between the BrowserPlatformUtils and offscreen document * [PM-5880] Adjusting how readText is handled within BrowserClipboardService * [PM-5880] Adjusting how readText is handled within BrowserClipboardService * [PM-5880] Working through implementation of chrome offscreen API usage * [PM-5880] Implementing jest tests for the methods added to the BrowserApi class * [PM-5880] Implementing jest tests for the OffscreenDocument class * [PM-5880] Working through jest tests for BrowserClipboardService * [PM-5880] Adding typing information to the clipboard methods present within the BrowserPlatformUtilsService * [PM-5880] Working on adding ServiceWorkerGlobalScope typing information * [PM-5880] Updating window references when calling BrowserPlatformUtils methods * [PM-5880] Finishing out jest tests for the BrowserClipboardService * [PM-5880] Finishing out jest tests for the BrowserClipboardService * [PM-5880] Implementing jest tests to validate the changes within BrowserApi * [PM-5880] Implementing jest tests to ensure coverage within OffscreenDocument * [PM-5880] Implementing jest tests for the BrowserPlatformUtilsService * [PM-5880] Removing unused catch statements * [PM-5880] Implementing jest tests for the BrowserPlatformUtilsService * [PM-5880] Implementing jest tests for the BrowserPlatformUtilsService * [PM-5880] Fixing broken tests
This commit is contained in:
@@ -44,6 +44,7 @@ const i18n = {
|
||||
};
|
||||
|
||||
const tabs = {
|
||||
get: jest.fn(),
|
||||
executeScript: jest.fn(),
|
||||
sendMessage: jest.fn(),
|
||||
query: jest.fn(),
|
||||
@@ -111,6 +112,18 @@ const extension = {
|
||||
getViews: jest.fn(),
|
||||
};
|
||||
|
||||
const offscreen = {
|
||||
createDocument: jest.fn(),
|
||||
closeDocument: jest.fn((callback) => {
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
}),
|
||||
Reason: {
|
||||
CLIPBOARD: "clipboard",
|
||||
},
|
||||
};
|
||||
|
||||
// set chrome
|
||||
global.chrome = {
|
||||
i18n,
|
||||
@@ -123,4 +136,5 @@ global.chrome = {
|
||||
port,
|
||||
privacy,
|
||||
extension,
|
||||
offscreen,
|
||||
} as any;
|
||||
|
||||
Reference in New Issue
Block a user