Skip to content

Commit

Permalink
Merge pull request #4495 from mirumee/fix/makestyles-snapshots
Browse files Browse the repository at this point in the history
Do not allow random ids to appear in snapshots
  • Loading branch information
maarcingebala committed Jul 19, 2019
2 parents 40e7cb2 + 04553f3 commit 70d6690
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 149 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ All notable, unreleased changes to this project will be documented in this file.
- New translations:
- Greek
- Fix searches and pickers - #4487 by @dominik-zeglen
- Do not allow random ids to appear in snapshots - #4495 by @dominik-zeglen


## 2.8.0
Expand Down
8 changes: 8 additions & 0 deletions saleor/static/dashboard-next/storybook/Stories.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import createGenerateClassName from "@material-ui/core/styles/createGenerateClassName";
import createHookGenerateClassName from "@material-ui/styles/createGenerateClassName";
import initStoryshots from "@storybook/addon-storyshots";
// tslint:disable no-submodule-imports
import generateRandomKey from "draft-js/lib/generateRandomKey";
Expand All @@ -15,6 +16,13 @@ jest.mock("@material-ui/core/styles/createGenerateClassName");
}
);

jest.mock("@material-ui/styles/createGenerateClassName");
(createHookGenerateClassName as any).mockImplementation(
() => (rule, stylesheet) => {
return [stylesheet.options.meta, rule.key, "id"].join("-");
}
);

jest.mock("draft-js/lib/generateRandomKey");
(generateRandomKey as any).mockImplementation(() => "testKey");

Expand Down

0 comments on commit 70d6690

Please sign in to comment.