Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DiffContextChange = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Change the number of diff context lines while in the staging panel", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13a\n14a\n15a") shell.Commit("one") shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13b\n14a\n15a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().Staging(). IsFocused(). Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains(`@@ -1,6 +1,6 @@`), Contains(` 1a`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), Contains(` 5a`), Contains(` 6a`), ). Press(keys.Universal.IncreaseContextInDiffView). SelectedLines( Contains(`@@ -1,7 +1,7 @@`), Contains(` 1a`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), Contains(` 5a`), Contains(` 6a`), Contains(` 7a`), ). Press(keys.Universal.DecreaseContextInDiffView). SelectedLines( Contains(`@@ -1,6 +1,6 @@`), Contains(` 1a`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), Contains(` 5a`), Contains(` 6a`), ). Press(keys.Universal.DecreaseContextInDiffView). SelectedLines( Contains(`@@ -1,5 +1,5 @@`), Contains(` 1a`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), Contains(` 5a`), ). Press(keys.Universal.DecreaseContextInDiffView). SelectedLines( Contains(`@@ -2,3 +2,3 @@`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), ). PressPrimaryAction(). Press(keys.Universal.TogglePanel) t.Views().StagingSecondary(). IsFocused(). Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains(`@@ -2,3 +2,3 @@`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), ). Press(keys.Universal.IncreaseContextInDiffView). SelectedLines( Contains(`@@ -1,5 +1,5 @@`), Contains(` 1a`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), Contains(` 5a`), ) }, })
View Source
var DiscardAllChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Discard all changes of a file in the staging panel, then assert we land in the staging panel of the next file", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "one\ntwo\n") shell.CreateFileAndAdd("file2", "1\n2\n") shell.Commit("one") shell.UpdateFile("file1", "one\ntwo\nthree\nfour\n") shell.UpdateFile("file2", "1\n2\n3\n4\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Contains("file1").IsSelected(), Contains("file2"), ). PressEnter() t.Views().Staging(). IsFocused(). SelectedLines(Contains("+three")). Press(keys.Universal.Remove). Tap(func() { t.Common().ConfirmDiscardLines() }). SelectedLines(Contains("+four")). Press(keys.Universal.Remove). Tap(func() { t.Common().ConfirmDiscardLines() t.Views().Files(). Lines( Contains("file2").IsSelected(), ) }). IsFocused(). SelectedLines(Contains("+3")) }, })
View Source
var Search = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Use the search feature in the staging panel", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFile("file1", "one\ntwo\nthree\nfour\nfive") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().Staging(). IsFocused(). Press(keys.Universal.StartSearch). Tap(func() { t.ExpectSearch(). Type("four"). Confirm() t.Views().Search().Content(Contains("matches for 'four' (1 of 1)")) }). SelectedLine(Contains("+four")). PressPrimaryAction(). Content(DoesNotContain("+four")). Tap(func() { t.Views().StagingSecondary(). Content(Contains("+four")) }) }, })
View Source
var StageHunks = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage and unstage various hunks of a file in the staging panel", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "1a\n2a\n3a\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13a\n14a\n15a") shell.Commit("one") shell.UpdateFile("file1", "1a\n2a\n3b\n4a\n5a\n6a\n7a\n8a\n9a\n10a\n11a\n12a\n13b\n14a\n15a") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().Staging(). IsFocused(). SelectedLines( Contains("-3a"), ). Press(keys.Universal.NextBlock). SelectedLines( Contains("-13a"), ). Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains("@@ -10,6 +10,6 @@"), Contains(" 10a"), Contains(" 11a"), Contains(" 12a"), Contains("-13a"), Contains("+13b"), Contains(" 14a"), Contains(" 15a"), Contains(`\ No newline at end of file`), ). SelectPreviousItem(). SelectedLines( Contains(`@@ -1,6 +1,6 @@`), Contains(` 1a`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), Contains(` 5a`), Contains(` 6a`), ). SelectNextItem(). SelectedLines( Contains("@@ -10,6 +10,6 @@"), Contains(" 10a"), Contains(" 11a"), Contains(" 12a"), Contains("-13a"), Contains("+13b"), Contains(" 14a"), Contains(" 15a"), Contains(`\ No newline at end of file`), ). PressPrimaryAction(). ContainsLines( Contains("-3a"), Contains("+3b"), ). Tap(func() { t.Views().StagingSecondary(). ContainsLines( Contains("-13a"), Contains("+13b"), ) }). Press(keys.Universal.TogglePanel) t.Views().StagingSecondary(). IsFocused(). SelectedLines( Contains("-13a"), ). PressPrimaryAction(). SelectedLines( Contains("+13b"), ). PressPrimaryAction(). IsEmpty() t.Views().Staging(). IsFocused(). SelectedLines( Contains("-3a"), ). Press(keys.Main.ToggleSelectHunk). SelectedLines( Contains(`@@ -1,6 +1,6 @@`), Contains(` 1a`), Contains(` 2a`), Contains(`-3a`), Contains(`+3b`), Contains(` 4a`), Contains(` 5a`), Contains(` 6a`), ). Press(keys.Universal.Remove). Tap(func() { t.Common().ConfirmDiscardLines() }). Content(DoesNotContain("-3a").DoesNotContain("+3b")). SelectedLines( Contains("@@ -10,6 +10,6 @@"), Contains(" 10a"), Contains(" 11a"), Contains(" 12a"), Contains("-13a"), Contains("+13b"), Contains(" 14a"), Contains(" 15a"), Contains(`\ No newline at end of file`), ) }, })
View Source
var StageLines = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage and unstage various lines of a file in the staging panel", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "one\ntwo\n") shell.Commit("one") shell.UpdateFile("file1", "one\ntwo\nthree\nfour\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().Staging(). IsFocused(). SelectedLines(Contains("+three")). PressPrimaryAction(). Content(DoesNotContain("+three")). Tap(func() { t.Views().StagingSecondary(). ContainsLines( Contains("+three"), ) }). SelectedLines(Contains("+four")). PressPrimaryAction(). IsEmpty() t.Views().StagingSecondary(). IsFocused(). ContainsLines( Contains("+three"), Contains("+four"), ). SelectedLines(Contains("+three")). PressPrimaryAction(). Content(DoesNotContain("+three")). Tap(func() { t.Views().Staging(). ContainsLines( Contains("+three"), ) }). SelectedLines(Contains("+four")). Press(keys.Universal.Remove). IsEmpty() t.Views().Staging(). IsFocused(). ContainsLines( Contains("+three"), Contains("+four"), ). SelectedLines(Contains("+three")). PressPrimaryAction(). Content(DoesNotContain("+three")). Tap(func() { t.Views().StagingSecondary(). Content(Contains("+three")) }). Press(keys.Universal.TogglePanel) t.Views().StagingSecondary(). IsFocused(). Press(keys.Universal.TogglePanel) t.Views().Staging(). SelectedLines(Contains("+four")). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Unstage lines")). Content(Contains("Are you sure you want to delete the selected lines")). Confirm() }). IsEmpty() t.Views().StagingSecondary(). IsFocused(). ContainsLines( Contains("+three"), ). PressEscape() t.Views().Files(). IsFocused(). Lines( Contains("M file1").IsSelected(), ). PressEnter() t.Views().StagingSecondary(). IsFocused() }, })
View Source
var StageRanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stage and unstage various ranges of a file in the staging panel", ExtraCmdArgs: "", Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file1", "one\ntwo\n") shell.Commit("one") shell.UpdateFile("file1", "one\ntwo\nthree\nfour\nfive\nsix\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). Lines( Contains("file1").IsSelected(), ). PressEnter() t.Views().Staging(). IsFocused(). SelectedLines( Contains("+three"), ). Press(keys.Main.ToggleDragSelect). NavigateToLine(Contains("+five")). SelectedLines( Contains("+three"), Contains("+four"), Contains("+five"), ). PressPrimaryAction(). SelectedLines( Contains("+six"), ). ContainsLines( Contains(" five"), Contains("+six"), ). Tap(func() { t.Views().StagingSecondary(). ContainsLines( Contains("+three"), Contains("+four"), Contains("+five"), ) }). Press(keys.Universal.TogglePanel) t.Views().StagingSecondary(). IsFocused(). SelectedLines( Contains("+three"), ). Press(keys.Main.ToggleDragSelect). NavigateToLine(Contains("+five")). SelectedLines( Contains("+three"), Contains("+four"), Contains("+five"), ). PressPrimaryAction(). IsEmpty(). Tap(func() { t.Views().Staging(). ContainsLines( Contains("+three"), Contains("+four"), Contains("+five"), Contains("+six"), ) }) t.Views().Staging(). IsFocused(). SelectedLines( Contains("+four"), ). Press(keys.Main.ToggleDragSelect). SelectNextItem(). SelectedLines( Contains("+four"), Contains("+five"), ). Press(keys.Universal.Remove). Tap(func() { t.Common().ConfirmDiscardLines() }). ContainsLines( Contains("+three"), Contains("+six"), ) }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.