Skip to content

Commit f5ec8b0

Browse files
committed
storybook updated
1 parent 0d6ba6d commit f5ec8b0

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

.storybook/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ module.exports = {
3131
config.plugins = [
3232
...config.plugins,
3333
new webpack.NormalModuleReplacementPlugin(
34-
/webextension-polyfill-ts/,
34+
/webextension-polyfill/,
3535
(resource) => {
3636
// Gets absolute path to mock `webextension-polyfill-ts` package
3737
// NOTE: this is required beacuse the `webextension-polyfill-ts`
3838
// package can't be used outside the environment provided by web extensions
3939
const absRootMockPath = path.resolve(
4040
__dirname,
41-
"../src/__mocks__/webextension-polyfill-ts.ts",
41+
"../src/__mocks__/webextension-polyfill.ts",
4242
);
4343

4444
// Gets relative path from requesting module to our mocked module

src/__mocks__/webextension-polyfill-ts.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
// src/__mocks__/webextension-polyfill-ts
2-
// Update this file to include any mocks for the `webextension-polyfill-ts` package
1+
// src/__mocks__/webextension-polyfill
2+
// Update this file to include any mocks for the `webextension-polyfill` 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`
5+
// See .storybook/main.js to see how this module is swapped in for `webextension-polyfill`
66
export const browser: any = {
77
tabs: {
88
executeScript(currentTabId: number, details: any) {
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// src/__mocks__/webextension-polyfill-ts
2+
// Update this file to include any mocks for the `webextension-polyfill-ts` package
3+
// This is used to mock these values for Storybook so you can develop your components
4+
// 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`
6+
export const browser: any = {
7+
tabs: {
8+
executeScript(currentTabId: number, details: any) {
9+
return Promise.resolve({ done: true });
10+
},
11+
query(params: any): Promise<Tab[]> {
12+
return Promise.resolve([]);
13+
},
14+
},
15+
runtime: {
16+
sendMessage: (params: { popupMounted: boolean }) => {
17+
return;
18+
},
19+
},
20+
};
21+
22+
interface Tab {
23+
id: number;
24+
}
25+
26+
export interface Tabs {
27+
Tab: Tab;
28+
}

0 commit comments

Comments
 (0)