Skip to content

Commit

Permalink
[feenkcom/gtoolkit#3701] example for extracting from inspector snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
j-brant committed Mar 27, 2024
1 parent be9cd09 commit c5f1b83
Showing 1 changed file with 59 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,65 @@ GtPharoSnippetCoderByScripterExamples >> contextMenuInspect [
^ aScripter
]

{ #category : #'examples - extract method' }
GtPharoSnippetCoderByScripterExamples >> extractMethodFromInspector_01_setup [
<gtExample>
| aScripter |
aScripter := self
scripterForBlock: [ ((GtPharoSnippetCoder forSource: 'array size - self size')
behavior: OrderedCollection;
yourself) asCoderViewModel
selfObject: OrderedCollection new;
yourself ].
aScripter
clickStep: [ :s |
s
label: 'Click on the coder editor to give it focus';
// GtSourceCoderEditorId ].
aScripter
doStep: [ :s |
s
label: 'Select part of the method to extract';
// GtSourceCoderEditorId;
action: [ :aSourceEditor |
aSourceEditor selecter
from: 0 to: aSourceEditor text size;
select ] ].
^ aScripter
]

{ #category : #'examples - extract method' }
GtPharoSnippetCoderByScripterExamples >> extractMethodFromInspector_02_extract [
<gtExample>
| aScripter |
aScripter := self extractMethodFromInspector_01_setup.
aScripter
secondaryClickStep: [ :s |
s
label: 'Open context menu';
// GtSourceCoderEditorId ].
aScripter
mouseMoveOverStep: [ :s |
s
label: 'Hover extract method';
onSpaceRoot;
// GtMethodCoderExtractMethodContextMenuItemId ].
aScripter
clickStep: [ :s |
s
label: 'Click extract method';
onSpaceRoot;
// GtMethodCoderExtractMethodContextMenuItemId ].

aScripter
assertStep: [ :s |
s
label: 'Assert source code modified';
onModel;
satisfies: [ :aCoder | (RBParser parseExpression: aCoder sourceText asString) selector isUnary ] ].
^ aScripter
]

{ #category : #'examples - fixit method' }
GtPharoSnippetCoderByScripterExamples >> fixitMessageSendToBlockClosure01setup [
<gtExample>
Expand Down

0 comments on commit c5f1b83

Please sign in to comment.