Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Diff = NewIntegrationTest(NewIntegrationTestArgs{ Description: "View the diff of two branches, then view the reverse diff", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") shell.CreateFileAndAdd("file1", "first line") shell.Commit("first commit") shell.NewBranch("branch-b") shell.UpdateFileAndAdd("file1", "first line\nsecond line") shell.Commit("update") shell.Checkout("branch-a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). TopLines( Contains("branch-a"), Contains("branch-b"), ). Press(keys.Universal.DiffingMenu) t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains(`Diff branch-a`)).Confirm() t.Views().Branches(). IsFocused(). Tap(func() { t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-a")) }). SelectNextItem(). Tap(func() { t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-b")) t.Views().Main().Content(Contains("+second line")) }). PressEnter() t.Views().SubCommits(). IsFocused(). SelectedLine(Contains("update")). Tap(func() { t.Views().Main().Content(Contains("+second line")) }). PressEnter() t.Views().CommitFiles(). IsFocused(). SelectedLine(Contains("file1")). Tap(func() { t.Views().Main().Content(Contains("+second line")) }). PressEscape() t.Views().SubCommits().PressEscape() t.Views().Branches(). IsFocused(). Press(keys.Universal.DiffingMenu) t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("Reverse diff direction")).Confirm() t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-b -R")) t.Views().Main().Content(Contains("-second line")) }, })
View Source
var DiffAndApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a patch from the diff between two branches and apply the patch.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.NewBranch("branch-a") shell.CreateFileAndAdd("file1", "first line\n") shell.Commit("first commit") shell.NewBranch("branch-b") shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") shell.Commit("update") shell.Checkout("branch-a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Branches(). Focus(). Lines( Contains("branch-a"), Contains("branch-b"), ). Press(keys.Universal.DiffingMenu) t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Equals("Diff branch-a")).Confirm() t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-a")) t.Views().Branches(). IsFocused(). SelectNextItem(). Tap(func() { t.Views().Information().Content(Contains("Showing output for: git diff --stat -p branch-a branch-b")) t.Views().Main().Content(Contains("+second line")) }). PressEnter() t.Views().SubCommits(). IsFocused(). SelectedLine(Contains("update")). Tap(func() { t.Views().Main().Content(Contains("+second line")) }). PressEnter() t.Views().CommitFiles(). IsFocused(). SelectedLine(Contains("file1")). Tap(func() { t.Views().Main().Content(Contains("+second line")) }). PressPrimaryAction(). Press(keys.Universal.DiffingMenu). Tap(func() { t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("Exit diff mode")).Confirm() t.Views().Information().Content(Contains("Building patch")) }). Press(keys.Universal.CreatePatchOptionsMenu) t.ExpectPopup().Menu().Title(Equals("Patch options")).Select(MatchesRegexp("Apply patch$")).Confirm() t.Views().Files(). Focus(). SelectedLine(Contains("file1")) t.Views().Main().Content(Contains("+second line")) }, })
View Source
var DiffCommits = NewIntegrationTest(NewIntegrationTestArgs{ Description: "View the diff between two commits", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "first line\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") shell.Commit("second commit") shell.UpdateFileAndAdd("file1", "first line\nsecond line\nthird line\n") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), ). Press(keys.Universal.DiffingMenu). Tap(func() { t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(MatchesRegexp(`Diff \w+`)).Confirm() t.Views().Information().Content(Contains("Showing output for: git diff")) }). SelectNextItem(). SelectNextItem(). SelectedLine(Contains("first commit")). Tap(func() { t.Views().Main().Content(Contains("-second line\n-third line")) }). Press(keys.Universal.DiffingMenu). Tap(func() { t.ExpectPopup().Menu().Title(Equals("Diffing")).Select(Contains("Reverse diff direction")).Confirm() t.Views().Main().Content(Contains("+second line\n+third line")) }). PressEnter() t.Views().CommitFiles(). IsFocused(). SelectedLine(Contains("file1")) t.Views().Main().Content(Contains("+second line\n+third line")) }, })
View Source
var DiffNonStickyRange = NewIntegrationTest(NewIntegrationTestArgs{ Description: "View the combined diff of multiple commits using a range selection", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFileAndAdd("file1", "first line\n") shell.Commit("first commit") shell.UpdateFileAndAdd("file1", "first line\nsecond line\n") shell.Commit("second commit") shell.UpdateFileAndAdd("file1", "first line\nsecond line\nthird line\n") shell.Commit("third commit") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits(). Focus(). Lines( Contains("third commit").IsSelected(), Contains("second commit"), Contains("first commit"), Contains("initial commit"), ). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.RangeSelectDown). Tap(func() { t.Views().Main().Content(Contains("Showing diff for range "). Contains("+first line\n+second line\n+third line")) }). PressEnter() t.Views().CommitFiles(). IsFocused(). SelectedLine(Contains("file1")) t.Views().Main().Content(Contains("+first line\n+second line\n+third line")) }, })
View Source
var IgnoreWhitespace = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Toggle whitespace in the diff", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("myfile", initialFileContent) shell.Commit("initial commit") shell.UpdateFile("myfile", updatedFileContent) }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Main().ContainsLines( Contains(`-first-line`), Contains(`-old-second-line`), Contains(`-third-line`), Contains(`+ first-line`), Contains(`+ new-second-line`), Contains(`+ third-line`), ) t.Views().Files(). IsFocused(). Press(keys.Universal.ToggleWhitespaceInDiffView) t.Views().Main().ContainsLines( Contains(` first-line`), Contains(`-old-second-line`), Contains(`+ new-second-line`), Contains(` third-line`), ) t.Views().Files(). IsFocused(). Press(keys.Universal.ToggleWhitespaceInDiffView) t.Views().Main().ContainsLines( Contains(`-first-line`), Contains(`-old-second-line`), Contains(`-third-line`), Contains(`+ first-line`), Contains(`+ new-second-line`), Contains(`+ third-line`), ) }, })
View Source
var RenameSimilarityThresholdChange = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Change the rename similarity threshold while in the commits panel", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("original", "one\ntwo\nthree\nfour\nfive\n") shell.Commit("add original") shell.DeleteFileAndAdd("original") shell.CreateFileAndAdd("renamed", "one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine\nten\n") shell.Commit("change name and contents") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Commits().Focus() t.Views().Main(). ContainsLines( Contains("2 files changed, 10 insertions(+), 5 deletions(-)"), ) t.Views().Commits(). Press(keys.Universal.DecreaseRenameSimilarityThreshold). Tap(func() { t.ExpectToast(Equals("Changed rename similarity threshold to 45%")) }) t.Views().Main(). ContainsLines( Contains("original => renamed"), Contains("1 file changed, 5 insertions(+)"), ) }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.