From 917a2ba1d664774861b8d856f06b14ee5358d0ef Mon Sep 17 00:00:00 2001 From: Rene Pfeuffer Date: Thu, 9 Jan 2020 16:31:28 +0100 Subject: [PATCH] Add story for diffs with binary files --- .../src/__resources__/Diff.binary.ts | 18 ++ .../src/__snapshots__/storyshots.test.ts.snap | 299 ++++++++++++++++++ .../ui-components/src/repos/Diff.stories.tsx | 5 + 3 files changed, 322 insertions(+) create mode 100644 scm-ui/ui-components/src/__resources__/Diff.binary.ts diff --git a/scm-ui/ui-components/src/__resources__/Diff.binary.ts b/scm-ui/ui-components/src/__resources__/Diff.binary.ts new file mode 100644 index 0000000000..d11d0fcc0e --- /dev/null +++ b/scm-ui/ui-components/src/__resources__/Diff.binary.ts @@ -0,0 +1,18 @@ +export default `diff --git a/Main.java b/Main.java +index 9b5ca13..7ced845 100644 +--- a/Main.java ++++ b/Main.java +@@ -1,5 +1,5 @@ + class Main { + - public static void main(String[] args) { + + public static void main(String[] arguments) { + System.out.println("Expect nothing more to happen."); + } +} +diff --git a/conflict.png b/conflict.png +new file mode 100644 +index 0000000..7c77c7f +--- /dev/null ++++ b/conflict.png +Binary files differ +`; diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap index 8034701cbd..27e3eb6da0 100644 --- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap +++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap @@ -334,6 +334,305 @@ exports[`Storyshots DateFromNow Default 1`] = ` `; +exports[`Storyshots Diff Binaries 1`] = ` +Array [ +
+
+
+
+ + + Main.java + + + modify + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ 1 + + 1 + + class Main { +
+ 2 + + 2 + + - public static void main(String[] args) { +
+ 3 + + 3 + + + public static void main(String[] arguments) { +
+ 4 + + 4 + + System.out.println("Expect nothing more to happen."); +
+ 5 + + 5 + + } +
+
+
, +
+
+
+
+ + conflict.png + + + modify + +
+
+
+
+ +
+
+
+
+
+
+ + + + + + +
+
+
, +] +`; + exports[`Storyshots Diff Collapsed 1`] = ` Array [
{ const hunkDiffFiles = parser.parse(hunksDiff); return ; + }) + .add("Binaries", () => { + const binaryDiffFiles = parser.parse(binaryDiff); + return ; });