File tree Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Expand file tree Collapse file tree 3 files changed +28
-6
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,7 @@ func (a *HelpAction) Do(c Console) error {
180
180
181
181
// String represents the answer as a string.
182
182
func (a * HelpAction ) String () string {
183
- return fmt .Sprintf ("press %q" , a .icon )
183
+ return fmt .Sprintf ("press %q and see %q " , a .icon , a . help )
184
184
}
185
185
186
186
func pressHelp (help string , options ... string ) * HelpAction {
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ func TestMultiSelectPrompt(t *testing.T) {
63
63
scenario : "navigation" ,
64
64
expectSurvey : surveyexpect .Expect (func (s * surveyexpect.Survey ) {
65
65
s .ExpectMultiSelect ("Select destinations" ).
66
- Type ("United" ).
66
+ Type ("United" ).Delete ( 2 ).
67
67
ExpectOptions (
68
68
"> [ ] United Kingdom" ,
69
69
"[ ] United States" ,
@@ -158,10 +158,21 @@ func TestMultiSelectPrompt_NoHelpButStillExpect(t *testing.T) {
158
158
s .WithTimeout (50 * time .Millisecond )
159
159
160
160
s .ExpectMultiSelect ("Select destinations" ).
161
- ShowHelp ("Your favorite countries" )
161
+ ShowHelp ("Your favorite countries" ).
162
+ ExpectOptions (
163
+ "> [ ] option 1" ,
164
+ "[ ] option 2" ,
165
+ )
162
166
})(testingT )
163
167
164
- expectedError := "there are remaining expectations that were not met:\n \n Expect : MultiSelect Prompt\n Message: \" Select destinations\" \n press \" ?\" "
168
+ expectedError := `there are remaining expectations that were not met:
169
+
170
+ Expect : MultiSelect Prompt
171
+ Message: "Select destinations"
172
+ press "?" and see "Your favorite countries"
173
+ Expect a multiselect list:
174
+ > [ ] option 1
175
+ [ ] option 2`
165
176
166
177
p := & survey.MultiSelect {
167
178
Message : "Select destinations" ,
Original file line number Diff line number Diff line change @@ -135,10 +135,21 @@ func TestSelectPrompt_NoHelpButStillExpect(t *testing.T) {
135
135
s .WithTimeout (50 * time .Millisecond )
136
136
137
137
s .ExpectSelect ("Select a country" ).
138
- ShowHelp ("Your favorite country" )
138
+ ShowHelp ("Your favorite country" ).
139
+ ExpectOptions (
140
+ "> option 1" ,
141
+ "option 2" ,
142
+ )
139
143
})(testingT )
140
144
141
- expectedError := "there are remaining expectations that were not met:\n \n Expect : Select Prompt\n Message: \" Select a country\" \n press \" ?\" "
145
+ expectedError := `there are remaining expectations that were not met:
146
+
147
+ Expect : Select Prompt
148
+ Message: "Select a country"
149
+ press "?" and see "Your favorite country"
150
+ Expect a select list:
151
+ > option 1
152
+ option 2`
142
153
143
154
p := & survey.Select {
144
155
Message : "Select a country" ,
You can’t perform that action at this time.
0 commit comments