| 
 | 1 | +package stash  | 
 | 2 | + | 
 | 3 | +import (  | 
 | 4 | +	"github.com/jesseduffield/lazygit/pkg/config"  | 
 | 5 | +	. "github.com/jesseduffield/lazygit/pkg/integration/components"  | 
 | 6 | +)  | 
 | 7 | + | 
 | 8 | +var DropMultipleInFilteredMode = NewIntegrationTest(NewIntegrationTestArgs{  | 
 | 9 | +	Description:  "Drop multiple stash entries when filtering by path",  | 
 | 10 | +	ExtraCmdArgs: []string{},  | 
 | 11 | +	Skip:         false,  | 
 | 12 | +	SetupConfig:  func(config *config.AppConfig) {},  | 
 | 13 | +	SetupRepo: func(shell *Shell) {  | 
 | 14 | +		shell.EmptyCommit("initial commit")  | 
 | 15 | +		shell.CreateFileAndAdd("file1", "content1")  | 
 | 16 | +		shell.Stash("stash one")  | 
 | 17 | +		shell.CreateFileAndAdd("file2", "content2a")  | 
 | 18 | +		shell.Stash("stash two-a")  | 
 | 19 | +		shell.CreateFileAndAdd("file3", "content3")  | 
 | 20 | +		shell.Stash("stash three")  | 
 | 21 | +		shell.CreateFileAndAdd("file2", "content2b")  | 
 | 22 | +		shell.Stash("stash two-b")  | 
 | 23 | +		shell.CreateFileAndAdd("file4", "content4")  | 
 | 24 | +		shell.Stash("stash four")  | 
 | 25 | +	},  | 
 | 26 | +	Run: func(t *TestDriver, keys config.KeybindingConfig) {  | 
 | 27 | +		t.Views().Stash().  | 
 | 28 | +			Lines(  | 
 | 29 | +				Contains("stash four"),  | 
 | 30 | +				Contains("stash two-b"),  | 
 | 31 | +				Contains("stash three"),  | 
 | 32 | +				Contains("stash two-a"),  | 
 | 33 | +				Contains("stash one"),  | 
 | 34 | +			)  | 
 | 35 | + | 
 | 36 | +		t.GlobalPress(keys.Universal.FilteringMenu)  | 
 | 37 | +		t.ExpectPopup().Menu().  | 
 | 38 | +			Title(Equals("Filtering")).  | 
 | 39 | +			Select(Contains("Enter path to filter by")).  | 
 | 40 | +			Confirm()  | 
 | 41 | + | 
 | 42 | +		t.ExpectPopup().Prompt().  | 
 | 43 | +			Title(Equals("Enter path:")).  | 
 | 44 | +			Type("file2").  | 
 | 45 | +			Confirm()  | 
 | 46 | + | 
 | 47 | +		t.Views().Stash().  | 
 | 48 | +			Focus().  | 
 | 49 | +			Lines(  | 
 | 50 | +				Contains("stash two-b").IsSelected(),  | 
 | 51 | +				Contains("stash two-a"),  | 
 | 52 | +			).  | 
 | 53 | +			Press(keys.Universal.RangeSelectDown).  | 
 | 54 | +			Press(keys.Universal.Remove).  | 
 | 55 | +			Tap(func() {  | 
 | 56 | +				t.ExpectPopup().Confirmation().  | 
 | 57 | +					Title(Equals("Stash drop")).  | 
 | 58 | +					Content(Contains("Are you sure you want to drop the selected stash entry(ies)?")).  | 
 | 59 | +					Confirm()  | 
 | 60 | +			}).  | 
 | 61 | +			/* EXPECTED:  | 
 | 62 | +			IsEmpty()  | 
 | 63 | +			ACTUAL: */  | 
 | 64 | +			Lines(  | 
 | 65 | +				Contains("stash two-a"),  | 
 | 66 | +			)  | 
 | 67 | + | 
 | 68 | +		t.GlobalPress(keys.Universal.Return) // cancel filtering mode  | 
 | 69 | +		t.Views().Stash().  | 
 | 70 | +			Lines(  | 
 | 71 | +				/* EXPECTED:  | 
 | 72 | +				Contains("stash four"),  | 
 | 73 | +				Contains("stash three"),  | 
 | 74 | +				Contains("stash one"),  | 
 | 75 | +				ACTUAL: */  | 
 | 76 | +				Contains("stash four"),  | 
 | 77 | +				Contains("stash two-a"),  | 
 | 78 | +				Contains("stash one"),  | 
 | 79 | +			)  | 
 | 80 | +	},  | 
 | 81 | +})  | 
0 commit comments