Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Apply = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Apply a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). PressPrimaryAction(). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash apply")). Content(Contains("Are you sure you want to apply this stash entry?")). Confirm() }). Lines( Contains("stash one").IsSelected(), ) t.Views().Files(). IsFocused(). Lines( Contains("file"), ) }, })
View Source
var ApplyPatch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Restore part of a stash entry via applying a custom patch", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("myfile", "content") shell.CreateFile("myfile2", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). PressEnter(). Tap(func() { t.Views().CommitFiles(). IsFocused(). Lines( Equals("▼ /").IsSelected(), Contains("myfile"), Contains("myfile2"), ). SelectNextItem(). PressPrimaryAction() t.Views().Information().Content(Contains("Building patch")) t.Views(). CommitFiles(). Press(keys.Universal.CreatePatchOptionsMenu) t.ExpectPopup().Menu(). Title(Equals("Patch options")). Select(MatchesRegexp(`Apply patch$`)).Confirm() }) t.Views().Files().Lines( Contains("myfile"), ) }, })
View Source
var CreateBranch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Create a branch from a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("myfile", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). Press(keys.Universal.New). Tap(func() { t.ExpectPopup().Prompt(). Title(Contains("New branch name (branch is off of 'stash@{0}: On master: stash one'")). Type("new_branch"). Confirm() }) t.Views().Files().IsEmpty() t.Views().Branches(). IsFocused(). Lines( Contains("new_branch").IsSelected(), Contains("master"), ). PressEnter() t.Views().SubCommits(). Lines( Contains("On master: stash one").IsSelected(), MatchesRegexp(`index on master:.*initial commit`), Contains("initial commit"), ) t.Views().Main().Content(Contains("myfile | 1 +")) }, })
View Source
var Drop = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drop a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash drop")). Content(Contains("Are you sure you want to drop the selected stash entry(ies)?")). Confirm() }). IsEmpty() t.Views().Files().IsEmpty() }, })
View Source
var DropMultiple = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Drop multiple stash entries", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFileAndAdd("file1", "content1") shell.Stash("stash one") shell.CreateFileAndAdd("file2", "content2") shell.Stash("stash two") shell.CreateFileAndAdd("file3", "content3") shell.Stash("stash three") shell.CreateFileAndAdd("file4", "content4") shell.Stash("stash four") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). SelectNextItem(). Lines( Contains("stash four"), Contains("stash three").IsSelected(), Contains("stash two"), Contains("stash one"), ). Press(keys.Universal.ToggleRangeSelect). Press(keys.Universal.RangeSelectDown). Press(keys.Universal.Remove). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash drop")). Content(Contains("Are you sure you want to drop the selected stash entry(ies)?")). Confirm() }). Lines( Contains("stash four"), Contains("stash one"), ) t.Views().Files().IsEmpty() }, })
View Source
var Pop = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Pop a stash entry", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). Press(keys.Stash.PopStash). Tap(func() { t.ExpectPopup().Confirmation(). Title(Equals("Stash pop")). Content(Contains("Are you sure you want to pop this stash entry?")). Confirm() }). IsEmpty() t.Views().Files(). IsFocused(). Lines( Contains("file"), ) }, })
View Source
var PreventDiscardingFileChanges = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Check that it is not allowed to discard changes to a file of a stash", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() shell.Stash("stash one") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files().IsEmpty() t.Views().Stash(). Focus(). Lines( Contains("stash one").IsSelected(), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file").IsSelected(), ). Press(keys.Universal.Remove) t.ExpectPopup().Confirmation(). Title(Equals("Error")). Content(Contains("Changes can only be discarded from local commits")). Confirm() }, })
View Source
var Rename = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Try to rename the stash.", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell. EmptyCommit("blah"). CreateFileAndAdd("file-1", "change to stash1"). Stash("foo"). CreateFileAndAdd("file-2", "change to stash2"). Stash("bar") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). Focus(). Lines( Contains("On master: bar"), Contains("On master: foo"), ). SelectNextItem(). Press(keys.Stash.RenameStash). Tap(func() { t.ExpectPopup().Prompt().Title(Equals("Rename stash: stash@{1}")).Type(" baz").Confirm() }). SelectedLine(Contains("On master: foo baz")) t.Views().Main().Content(Contains("file-1")) }, })
View Source
var Stash = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stashing files directly (not going through the stash menu)", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Contains("file"), ). Press(keys.Files.StashAllChanges) t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( MatchesRegexp(`\ds .* my stashed file`), ) t.Views().Files(). IsEmpty() }, })
View Source
var StashAll = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stashing all changes (via the menu)", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file", "content") shell.GitAddAll() }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Contains("file"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash all changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). IsEmpty() }, })
View Source
var StashAndKeepIndex = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash staged changes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "content") shell.CreateFileAndAdd("file-unstaged", "content") shell.EmptyCommit("initial commit") shell.UpdateFileAndAdd("file-staged", "new content") shell.UpdateFile("file-unstaged", "new content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("▼ /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(Contains("Stash all changes and keep index")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). Lines( Equals("M file-staged"), ) t.Views().Stash(). Focus(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Equals("▼ /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ) }, })
View Source
var StashIncludingUntrackedFiles = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stashing all files including untracked ones", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.EmptyCommit("initial commit") shell.CreateFile("file_1", "content") shell.CreateFile("file_2", "content") shell.GitAdd("file_1") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("▼ /"), Equals(" A file_1"), Equals(" ?? file_2"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(Contains("Stash all changes including untracked files")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). IsEmpty() }, })
View Source
var StashStaged = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash staged changes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "content") shell.CreateFileAndAdd("file-unstaged", "content") shell.EmptyCommit("initial commit") shell.UpdateFileAndAdd("file-staged", "new content") shell.UpdateFile("file-unstaged", "new content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("▼ /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash staged changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). Lines( Equals(" M file-unstaged"), ) t.Views().Stash(). Focus(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file-staged").IsSelected(), ) }, })
View Source
var StashStagedPartialFile = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash staged changes when a file is partially staged", ExtraCmdArgs: []string{}, GitVersion: AtLeast("git version 2.35.0"), Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "line1\nline2\nline3\nline4\n") shell.Commit("initial commit") shell.UpdateFile("file-staged", "line1\nline2 mod\nline3\nline4 mod\n") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Files(). IsFocused(). PressEnter() t.Views().Staging(). Content( Contains(" line1\n-line2\n+line2 mod\n line3\n-line4\n+line4 mod"), ). PressPrimaryAction(). PressPrimaryAction(). Content( Contains(" line1\n line2 mod\n line3\n-line4\n+line4 mod"), ). PressEscape() t.Views().Files(). IsFocused(). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash staged changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Focus(). Lines( Contains("my stashed file"), ). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file-staged").IsSelected(), ) t.Views().Main(). Content( Contains(" line1\n-line2\n+line2 mod\n line3\n line4"), ) t.Views().Files(). Lines( Contains("file-staged"), ) t.Views().Staging(). Content( Contains(" line1\n line2\n line3\n-line4\n+line4 mod"), ) }, })
View Source
var StashUnstaged = NewIntegrationTest(NewIntegrationTestArgs{ Description: "Stash unstaged changes", ExtraCmdArgs: []string{}, Skip: false, SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shell.CreateFileAndAdd("file-staged", "content") shell.CreateFileAndAdd("file-unstaged", "content") shell.EmptyCommit("initial commit") shell.UpdateFileAndAdd("file-staged", "new content") shell.UpdateFile("file-unstaged", "new content") }, Run: func(t *TestDriver, keys config.KeybindingConfig) { t.Views().Stash(). IsEmpty() t.Views().Files(). Lines( Equals("▼ /"), Equals(" M file-staged"), Equals(" M file-unstaged"), ). Press(keys.Files.ViewStashOptions) t.ExpectPopup().Menu().Title(Equals("Stash options")).Select(MatchesRegexp("Stash unstaged changes$")).Confirm() t.ExpectPopup().Prompt().Title(Equals("Stash changes")).Type("my stashed file").Confirm() t.Views().Stash(). Lines( Contains("my stashed file"), ) t.Views().Files(). Lines( Contains("file-staged"), ) t.Views().Stash(). Focus(). PressEnter() t.Views().CommitFiles(). IsFocused(). Lines( Contains("file-unstaged").IsSelected(), ) }, })
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.