Skip to content

Commit 2c3ae5d

Browse files
committed
improve GtPharoMethodCoderStep>>#typeText: [feenkcom/gtoolkit#4768]
1 parent c969b9a commit 2c3ae5d

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

src/GToolkit-Pharo-Coder-Method-Examples/GtPharoMethodCoderStep.class.st

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,17 @@ GtPharoMethodCoderStep >> coderViewModelDo: aBlock [
534534
onParentStepTarget: self
535535
]
536536

537+
{ #category : #'steps - interactions' }
538+
GtPharoMethodCoderStep >> editorDo: aBlock [
539+
^ self do
540+
referenceSender;
541+
label: 'Access editor';
542+
block: aBlock;
543+
onParentStepTarget: self;
544+
onThisOrDeepChildElementId: GtSourceCoderEditorId;
545+
onTopMost
546+
]
547+
537548
{ #category : #'steps - interactions' }
538549
GtPharoMethodCoderStep >> editorTextDo: aBlock [
539550
^ self do
@@ -715,13 +726,29 @@ GtPharoMethodCoderStep >> typeText: aString [
715726
"The event is eventually handled in {{gtMethod:BrTextEditorInsertionHandler>>#textInputEvent:}}.
716727
Note that all characters must be printable, otherwise the event is ignored."
717728

718-
^ self type
719-
referenceSender;
720-
label: ('Type text: {1}' format: { aString });
721-
text: aString;
722-
onParentStepTarget: self;
723-
onThisOrDeepChildElementId: GtSourceCoderEditorId;
724-
onTopMost
729+
^ aString lines size = 1
730+
ifTrue: [ self type
731+
referenceSender;
732+
label: ('Type text: {1}' format: {aString lines first});
733+
text: aString;
734+
onParentStepTarget: self;
735+
onThisOrDeepChildElementId: GtSourceCoderEditorId;
736+
onTopMost ]
737+
ifFalse: [ self
738+
substeps2: 'Type lines'
739+
do: [ :eachStep |
740+
aString lines
741+
do: [ :eachLine |
742+
eachStep type
743+
referenceSender;
744+
label: ('Type text: {1}' format: {aString lines first});
745+
text: eachLine;
746+
onParentStepTarget: eachStep;
747+
onThisOrDeepChildElementId: GtSourceCoderEditorId;
748+
onTopMost ]
749+
separatedBy: [ eachStep keyPress
750+
label: 'Press return';
751+
key: BlKeyboardKey return ] ] ]
725752
]
726753

727754
{ #category : #'steps - interactions' }

0 commit comments

Comments
 (0)