Skip to content

Commit a09c379

Browse files
committed
Update webextension-polyfill-ts mock
1 parent 578d88c commit a09c379

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
dist/js/*
2-
.vscode
32
storybook-static/*
43

54
/node_modules

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
- Updated placeholder icon for extension
1717
- Verified support for Microsoft Edge
1818
- Updated `README.md` screenshots
19+
- Add `.vscode` directory with workplace settings and recommended extensions

src/__mocks__/webextension-polyfill-ts.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,27 @@
22
// Update this file to include any mocks for the `webextension-polyfill-ts` package
33
// This is used to mock these values for Storybook so you can develop your components
44
// outside the Web Extension environment provided by a compatible browser
5+
// See .storybook/main.js to see how this module is swapped in for `webextension-polyfill-ts`
56
export const browser: any = {
67
tabs: {
78
executeScript(currentTabId: number, details: any) {
89
return Promise.resolve({ done: true });
910
},
11+
query(params: any): Promise<Tab[]> {
12+
return Promise.resolve([]);
13+
},
14+
},
15+
runtime: {
16+
sendMessage: (params: { popupMounted: boolean }) => {
17+
return;
18+
},
1019
},
1120
};
1221

22+
interface Tab {
23+
id: number;
24+
}
25+
1326
export interface Tabs {
14-
Tab: {
15-
id: number;
16-
};
27+
Tab: Tab;
1728
}

0 commit comments

Comments
 (0)