mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
fixed storyshots with react-diff-view
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -16,14 +16,17 @@ storiesOf("Diff", module)
|
|||||||
.add("Collapsed", () => <Diff diff={diffFiles} defaultCollapse={true} />)
|
.add("Collapsed", () => <Diff diff={diffFiles} defaultCollapse={true} />)
|
||||||
.add("File Controls", () => <Diff diff={diffFiles} fileControlFactory={() => <Button>Custom Control</Button>} />)
|
.add("File Controls", () => <Diff diff={diffFiles} fileControlFactory={() => <Button>Custom Control</Button>} />)
|
||||||
.add("File Annotation", () => (
|
.add("File Annotation", () => (
|
||||||
<Diff diff={diffFiles} fileAnnotationFactory={file => [<p>Custom File annotation for {file.newPath}</p>]} />
|
<Diff
|
||||||
|
diff={diffFiles}
|
||||||
|
fileAnnotationFactory={file => [<p key={file.newPath}>Custom File annotation for {file.newPath}</p>]}
|
||||||
|
/>
|
||||||
))
|
))
|
||||||
.add("Line Annotation", () => (
|
.add("Line Annotation", () => (
|
||||||
<Diff
|
<Diff
|
||||||
diff={diffFiles}
|
diff={diffFiles}
|
||||||
annotationFactory={ctx => {
|
annotationFactory={ctx => {
|
||||||
return {
|
return {
|
||||||
N2: [<p>Line Annotation</p>]
|
N2: <p key="N2">Line Annotation</p>
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,6 +1,22 @@
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import initStoryshots from "@storybook/addon-storyshots";
|
import initStoryshots, { snapshotWithOptions } from "@storybook/addon-storyshots";
|
||||||
|
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
|
const createNodeMock = (element: any) => {
|
||||||
|
if (element.type === "tr") {
|
||||||
|
return {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||||
|
querySelector: (selector: string) => {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
initStoryshots({
|
initStoryshots({
|
||||||
configPath: path.resolve(__dirname, "..", ".storybook")
|
configPath: path.resolve(__dirname, "..", ".storybook"),
|
||||||
|
// fix snapshot tests with react-diff-view which uses a ref on tr
|
||||||
|
// @see https://github.com/storybookjs/storybook/pull/1090
|
||||||
|
test: snapshotWithOptions({
|
||||||
|
createNodeMock
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user