File tree Expand file tree Collapse file tree 4 files changed +43
-15
lines changed Expand file tree Collapse file tree 4 files changed +43
-15
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,11 @@ func (self *CommitDescriptionPanelDriver) AddCoAuthor(author string) *CommitDesc
52
52
return self
53
53
}
54
54
55
+ func (self * CommitDescriptionPanelDriver ) Clear () * CommitDescriptionPanelDriver {
56
+ self .getViewDriver ().Clear ()
57
+ return self
58
+ }
59
+
55
60
func (self * CommitDescriptionPanelDriver ) Title (expected * TextMatcher ) * CommitDescriptionPanelDriver {
56
61
self .getViewDriver ().Title (expected )
57
62
Original file line number Diff line number Diff line change @@ -39,20 +39,7 @@ func (self *CommitMessagePanelDriver) SwitchToDescription() *CommitDescriptionPa
39
39
}
40
40
41
41
func (self * CommitMessagePanelDriver ) Clear () * CommitMessagePanelDriver {
42
- // clearing multiple times in case there's multiple lines
43
- // (the clear button only clears a single line at a time)
44
- maxAttempts := 100
45
- for i := 0 ; i < maxAttempts + 1 ; i ++ {
46
- if self .getViewDriver ().getView ().Buffer () == "" {
47
- break
48
- }
49
-
50
- self .t .press (ClearKey )
51
- if i == maxAttempts {
52
- panic ("failed to clear commit message panel" )
53
- }
54
- }
55
-
42
+ self .getViewDriver ().Clear ()
56
43
return self
57
44
}
58
45
Original file line number Diff line number Diff line change @@ -40,6 +40,24 @@ func (self *ViewDriver) Title(expected *TextMatcher) *ViewDriver {
40
40
return self
41
41
}
42
42
43
+ func (self * ViewDriver ) Clear () * ViewDriver {
44
+ // clearing multiple times in case there's multiple lines
45
+ // (the clear button only clears a single line at a time)
46
+ maxAttempts := 100
47
+ for i := 0 ; i < maxAttempts + 1 ; i ++ {
48
+ if self .getView ().Buffer () == "" {
49
+ break
50
+ }
51
+
52
+ self .t .press (ClearKey )
53
+ if i == maxAttempts {
54
+ panic ("failed to clear view buffer" )
55
+ }
56
+ }
57
+
58
+ return self
59
+ }
60
+
43
61
// asserts that the view has lines matching the given matchers. One matcher must be passed for each line.
44
62
// If you only care about the top n lines, use the TopLines method instead.
45
63
// If you only care about a subset of lines, use the ContainsLines method instead.
Original file line number Diff line number Diff line change @@ -28,13 +28,31 @@ var PreserveCommitMessage = NewIntegrationTest(NewIntegrationTestArgs{
28
28
Type ("second paragraph" ).
29
29
Cancel ()
30
30
31
+ t .FileSystem ().PathPresent (".git/LAZYGIT_PENDING_COMMIT" )
32
+
31
33
t .Views ().Files ().
32
34
IsFocused ().
33
35
Press (keys .Files .CommitChanges )
34
36
35
37
t .ExpectPopup ().CommitMessagePanel ().
36
38
Content (Equals ("my commit message" )).
37
39
SwitchToDescription ().
38
- Content (Equals ("first paragraph\n \n second paragraph" ))
40
+ Content (Equals ("first paragraph\n \n second paragraph" )).
41
+ Clear ().
42
+ SwitchToSummary ().
43
+ Clear ().
44
+ Cancel ()
45
+
46
+ t .FileSystem ().PathNotPresent (".git/LAZYGIT_PENDING_COMMIT" )
47
+
48
+ t .Views ().Files ().
49
+ IsFocused ().
50
+ Press (keys .Files .CommitChanges )
51
+
52
+ t .ExpectPopup ().CommitMessagePanel ().
53
+ Type ("my new commit message" ).
54
+ Confirm ()
55
+
56
+ t .FileSystem ().PathNotPresent (".git/LAZYGIT_PENDING_COMMIT" )
39
57
},
40
58
})
You can’t perform that action at this time.
0 commit comments