Skip to content

Commit

Permalink
Merge pull request #793 from jecisc/Cleaning-for-pharo-integration
Browse files Browse the repository at this point in the history
Cleaning-for-pharo-integration
  • Loading branch information
jecisc authored Oct 5, 2019
2 parents f3fcd55 + 6dafec5 commit 0d6da7a
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 82 deletions.
2 changes: 1 addition & 1 deletion src/Spec2-Adapters-Morphic-Tests/SpStyleTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Class {
#category : #'Spec2-Adapters-Morphic-Tests'
}

{ #category : #tests }
{ #category : #running }
SpStyleTest >> tearDown [

aClass ifNotNil: [ :e | e removeFromSystem ].
Expand Down
68 changes: 29 additions & 39 deletions src/Spec2-Backend-Tests/SpDropListAdapterTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ SpDropListAdapterTest >> initializeTestedInstance [

{ #category : #accessing }
SpDropListAdapterTest >> testAddingIconsShowTheIcon [
#(pharo add book) do: [ :each | self presenter addItemLabeled: each do: [ ] icon: (self iconNamed: each) ].

#(pharo add book) do: [ :each |
self presenter addItemLabeled: each do: [] icon: (self iconNamed: each)].

self presenter selectedItem: #pharo.
self presenter selectItem: #pharo.

self assert: self adapter selectedIndexes equals: #(4).
backendForTest assertIcon: self adapter displayedIcon equals: (self iconNamed: #pharo).
backendForTest assertIcon: self adapter displayedIcon equals: (self iconNamed: #pharo)
]

{ #category : #accessing }
Expand All @@ -37,41 +35,34 @@ SpDropListAdapterTest >> testDoesNotShowIcons [

{ #category : #accessing }
SpDropListAdapterTest >> testRemovingIconsAfterAddingThem [
#(pharo add book) do: [ :each | self presenter addItemLabeled: each do: [ ] icon: (self iconNamed: each) ].

#(pharo add book) do: [ :each |
self presenter addItemLabeled: each do: [] icon: (self iconNamed: each)].

self presenter selectedItem: nil.
self presenter selectItem: nil.
self presenter model removeAll.

#(pharo add book) do: [ :each |
self presenter addItemLabeled: each do: [] icon: nil].
#(pharo add book) do: [ :each | self presenter addItemLabeled: each do: [ ] icon: nil ].

self assert: self adapter selectedIndexes equals: #(1).
backendForTest assertIcon: self adapter displayedIcon equals: nil.
backendForTest assertIcon: self adapter displayedIcon equals: nil
]

{ #category : #accessing }
SpDropListAdapterTest >> testResetingSelectionResetsSelection [
self presenter selectItem: 10.

self presenter selectedItem: 10.

self presenter resetSelection.

self assert: self presenter selectedItem equals: nil.
self assert: self adapter selectedIndexes isEmpty.

self assert: self adapter selectedIndexes isEmpty
]

{ #category : #accessing }
SpDropListAdapterTest >> testSelectingASecondElementSelectsIt [

self presenter selectedItem: 10.
self presenter selectedItem: 20.
self presenter selectItem: 10.
self presenter selectItem: 20.

self assert: self presenter selectedItem equals: 20.
self assert: self adapter selectedIndexes equals: #(2).

self assert: self adapter selectedIndexes equals: #(2)
]

{ #category : #accessing }
Expand All @@ -86,24 +77,25 @@ SpDropListAdapterTest >> testSelectingAnElementInWidgetUpdatePresenter [

{ #category : #accessing }
SpDropListAdapterTest >> testSelectingAnElementSelectsIt [

self presenter selectedItem: 10.
self presenter selectItem: 10.

self assert: self presenter selectedItem equals: 10.
self assert: self adapter selectedIndexes equals: #(1).

self assert: self adapter selectedIndexes equals: #(1)
]

{ #category : #accessing }
SpDropListAdapterTest >> testSelectionExecutesBlock [

| selected |

self presenter dropListItems: (#(10 20 30)
collect: [ :e | SpDropListItem on: e do: [ selected := e ] ]).

self presenter selectedItem: 20.
self assert: selected equals: 20
self presenter
dropListItems:
(#(10 20 30)
collect: [ :e |
SpDropListItem
on: e
do: [ selected := e ] ]).

self presenter selectItem: 20.
self assert: selected equals: 20
]

{ #category : #accessing }
Expand All @@ -117,19 +109,17 @@ SpDropListAdapterTest >> testSelectionStartsSelectingFirst [
{ #category : #accessing }
SpDropListAdapterTest >> testSettingNilResetsGeneratesEvent [
| changed |
self presenter selectedItem: 10.
self presenter selectItem: 10.
self presenter whenSelectionChangedDo: [ changed := true ].
self presenter selectedItem: nil.
self presenter selectItem: nil.
self assert: changed
]

{ #category : #accessing }
SpDropListAdapterTest >> testSettingNilResetsSelection [

self presenter selectedItem: 10.
self presenter selectedItem: nil.
self presenter selectItem: 10.
self presenter selectItem: nil.

self assert: self presenter selectedItem equals: nil.
self assert: self adapter selectedIndexes isEmpty.

self assert: self adapter selectedIndexes isEmpty
]
5 changes: 2 additions & 3 deletions src/Spec2-Core/SpAbstractWidgetPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ SpAbstractWidgetPresenter >> help: aString [
SpAbstractWidgetPresenter >> initialize [
super initialize.

help := nil.
borderWidth := 0.
borderColor := Color transparent.
enabled := true.
Expand All @@ -237,8 +236,8 @@ SpAbstractWidgetPresenter >> initialize [
self whenEnabledChangedDo: [ :b | self withAdapterDo: [ :w | w update: #enabled: with: {b} ] ].
self property: #dragEnabled whenChangedDo: [ :b | self withWidgetDo: [ :w | w update: #dragEnabled: with: {b} ] ].
self property: #dropEnabled whenChangedDo: [ :b | self withWidgetDo: [ :w | w update: #dropEnabled: with: {b} ] ].
styles := #().

styles := #()
]

{ #category : #initialization }
Expand Down
3 changes: 0 additions & 3 deletions src/Spec2-Core/SpCodePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ SpCodePresenter >> initialize [

super initialize.

behavior := nil.
doItContext := nil.
doItReceiver := nil.
self withSyntaxHighlight.

self registerEventsForStyling.
Expand Down
14 changes: 0 additions & 14 deletions src/Spec2-Core/SpContainerPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,3 @@ SpContainerPresenter class >> adapterName [

^ #ContainerAdapter
]

{ #category : #'api-focus' }
SpContainerPresenter >> eventKeyStrokesForNextFocus [
"String describing the keystroke to perform to jump to the next widget"

^ keyStrokesForNextFocus
]

{ #category : #'api-focus' }
SpContainerPresenter >> eventKeyStrokesForPreviousFocus [
"String describing the keystroke to perform to jump to the previous widget"

^ keyStrokesForPreviousFocus
]
4 changes: 1 addition & 3 deletions src/Spec2-Core/SpDropListItem.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@ SpDropListItem >> icon: anObject [
{ #category : #initialization }
SpDropListItem >> initialize [
super initialize.

action := [ ].
displayBlock := [ :e | e asString ].
icon := nil
displayBlock := [ :e | e asString ]
]

{ #category : #accessing }
Expand Down
2 changes: 0 additions & 2 deletions src/Spec2-Core/SpImagePresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ SpImagePresenter >> image: aForm [
{ #category : #initialization }
SpImagePresenter >> initialize [
super initialize.

image := nil.
action := [ ].
autoScale := false
]
Expand Down
4 changes: 1 addition & 3 deletions src/Spec2-Core/SpNotebookPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ SpNotebookPresenter >> addPage: aPage [

{ #category : #initialization }
SpNotebookPresenter >> initialize [

super initialize.
pagesHolder := OrderedCollection new asValueHolder.
selectedPage := nil.


pagesHolder whenChangedDo: [ self pagesChanged ]
]

Expand Down
1 change: 0 additions & 1 deletion src/Spec2-Core/SpPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,6 @@ SpPresenter >> initialize [
super initialize.

visible := true.
additionalSubpresentersMap := nil.

self initializePrivateAnnouncer.
self initializePrivateValueHolders.
Expand Down
7 changes: 2 additions & 5 deletions src/Spec2-Core/SpVersatileDialogPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,10 @@ SpVersatileDialogPresenter >> footnoteIcon: aForm [

{ #category : #initialization }
SpVersatileDialogPresenter >> initialize [

super initialize.

moreOptionsVisible := false.
buttons := OrderedDictionary new.
result := nil.

moreOptionsVisible := false.
buttons := OrderedDictionary new
]

{ #category : #initialization }
Expand Down
5 changes: 1 addition & 4 deletions src/Spec2-Layout/SpSplitterHorizontal.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ SpSplitterHorizontal >> commands: anObject [

{ #category : #initialization }
SpSplitterHorizontal >> initialize [

super initialize.

selector := #newHSplitterAt:.
layoutFrame := (0@0 corner: 0@0) asSpLayoutFrame
bottomOffset: 1.
commands := nil.
layoutFrame := (0 @ 0 corner: 0 @ 0) asSpLayoutFrame bottomOffset: 1
]

{ #category : #testing }
Expand Down
5 changes: 1 addition & 4 deletions src/Spec2-Layout/SpSplitterVertical.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ SpSplitterVertical >> commands: anObject [

{ #category : #initialization }
SpSplitterVertical >> initialize [

super initialize.

selector := #newVSplitterAt:.
layoutFrame := ((0@0 corner: 0@0) asSpLayoutFrame
rightOffset: 1).
commands := nil.
layoutFrame := (0 @ 0 corner: 0 @ 0) asSpLayoutFrame rightOffset: 1
]

{ #category : #testing }
Expand Down

0 comments on commit 0d6da7a

Please sign in to comment.