Skip to content

Commit

Permalink
Merge 60472d2
Browse files Browse the repository at this point in the history
  • Loading branch information
Hernán Morales Durand committed Aug 29, 2024
2 parents 5ea47cc + 60472d2 commit 49975cf
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
25 changes: 25 additions & 0 deletions src/Spec2-Code-Tests/SpCodePresenterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,31 @@ SpCodePresenterTest >> testDoBrowseImplementors [
equals: { SpCodePresenterTest>>#testDoBrowseImplementors }
]

{ #category : 'tests - commands' }
SpCodePresenterTest >> testDoBrowseMethod [

| navigation |
navigation := SpCodeSystemNavigationMock new.
presenter systemNavigation: navigation.
presenter environment add: SpCodePresenterTest binding.
presenter environment add: SpCodeSystemNavigationMock binding.
presenter beForScripting.
self openInstance.


presenter text: 'Object'.
presenter doBrowseClass.

self assert: navigation messageList isNil.

navigation reset.
presenter text: 'selectAll'.
presenter doBrowseClass.

self assert: navigation browseSelector notEmpty.
self assert: navigation browseSelector equals: #selectAll
]

{ #category : 'tests - commands' }
SpCodePresenterTest >> testDoBrowseMethodReferences [

Expand Down
6 changes: 6 additions & 0 deletions src/Spec2-Code-Tests/SpCodeSystemNavigationMock.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ SpCodeSystemNavigationMock >> browse: aClass [
browseClass := aClass
]

{ #category : 'opening' }
SpCodeSystemNavigationMock >> browseAllImplementorsOf: aSelector [

browseSelector := aSelector
]

{ #category : 'accessing' }
SpCodeSystemNavigationMock >> browseClass [

Expand Down
6 changes: 4 additions & 2 deletions src/Spec2-Code/SpCodePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ SpCodePresenter >> doBrowseClass [
ifTrue: [
| classToBrowse |
classToBrowse := self class environment at: result ifAbsent: [ nil ].
classToBrowse ifNotNil: [ ^ self systemNavigation browse: classToBrowse ] ].
self systemNavigation browse: result
classToBrowse ifNotNil: [ ^ self systemNavigation browse: classToBrowse ] ].
result
ifNil: [ self systemNavigation browseAllImplementorsOf: self selectedTextOrLine asSymbol ]
ifNotNil: [ self systemNavigation browse: result ]
]

{ #category : 'commands' }
Expand Down

0 comments on commit 49975cf

Please sign in to comment.