Skip to content

Commit

Permalink
Merge pull request #3466 from jecisc/3465-Spec-sync
Browse files Browse the repository at this point in the history
3465-Spec-sync
  • Loading branch information
MarcusDenker committed Jun 11, 2019
2 parents 43d4984 + 734fbaa commit 050e413
Show file tree
Hide file tree
Showing 74 changed files with 1,449 additions and 959 deletions.
12 changes: 12 additions & 0 deletions src/Spec-BackendTests/CodeAdapterTest.class.st
Expand Up @@ -81,3 +81,15 @@ CodeAdapterTest >> testTextWithStyle [
self assertText: text atInterval: "test" (6 to: 11) isStyle: #comment.
self assertText: text atInterval: "42" (13 to: 14) isStyle: #number.
]

{ #category : #tests }
CodeAdapterTest >> testWithSyntaxHighlight [
presenter withSyntaxHighlight.
self assert: self adapter hasSyntaxHighlightEnabled
]

{ #category : #tests }
CodeAdapterTest >> testWithoutSyntaxHighlight [
presenter withoutSyntaxHighlight.
self deny: self adapter hasSyntaxHighlightEnabled
]
25 changes: 25 additions & 0 deletions src/Spec-BackendTests/ListCommonPropertiestTest.class.st
Expand Up @@ -9,6 +9,31 @@ ListCommonPropertiestTest >> classToTest [
^ ListPresenter
]

{ #category : #running }
ListCommonPropertiestTest >> testChangingFromMultipleToSingleSelection [
presenter beMultipleSelection.
self assert: presenter isMultipleSelection.
presenter beSingleSelection.
self deny: presenter isMultipleSelection
]

{ #category : #running }
ListCommonPropertiestTest >> testChangingFromSingleToMultipleSelection [
presenter beSingleSelection.
self deny: presenter isMultipleSelection.
presenter beMultipleSelection.
self assert: presenter isMultipleSelection
]

{ #category : #running }
ListCommonPropertiestTest >> testEnablingFilteringUpdateOpenedList [
self deny: self adapter hasFilter.
presenter enableItemSubstringFilter.
self assert: self adapter hasFilter.
presenter itemFilterBlock: nil.
self deny: self adapter hasFilter
]

{ #category : #running }
ListCommonPropertiestTest >> testRemoveHeaderTitleInPresenterRemovesColumnHeaderMorph [
SystemVersion current major = 7 ifTrue: [ "Test failing in Pharo7 due to a bug in FastTable" ^ self skip ].
Expand Down
2 changes: 1 addition & 1 deletion src/Spec-BackendTests/MockDynamicPresenter.class.st
Expand Up @@ -55,5 +55,5 @@ MockDynamicPresenter >> label [

{ #category : #action }
MockDynamicPresenter >> selectFirstElement [
list selectedIndex: 1
list selectIndex: 1
]
6 changes: 6 additions & 0 deletions src/Spec-BackendTests/MorphicCodeAdapter.extension.st
@@ -0,0 +1,6 @@
Extension { #name : #MorphicCodeAdapter }

{ #category : #'*Spec-BackendTests' }
MorphicCodeAdapter >> hasSyntaxHighlightEnabled [
^ (self widget textArea editingMode isKindOf: RubPlainTextMode) not
]
25 changes: 7 additions & 18 deletions src/Spec-Core/AbstractListPresenter.class.st
Expand Up @@ -123,21 +123,6 @@ AbstractListPresenter >> enableItemSubstringFilter [
self itemFilterBlock: [ :each :pattern | each asLowercase includesSubstring: pattern asLowercase ]
]

{ #category : #api }
AbstractListPresenter >> filteringBlock [
"<api: #inspect>"
"Return the filtering of the items"

^ filteringBlockHolder value
]

{ #category : #api }
AbstractListPresenter >> filteringBlock: aBlock [
"To set the filtering of the items. This filter will be used to filter the visible elements."

filteringBlockHolder value: aBlock
]

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

Expand All @@ -157,7 +142,6 @@ AbstractListPresenter >> initialize [

{ #category : #initialization }
AbstractListPresenter >> initializeValueHolders [
filteringBlockHolder := self defaultFilteringBlock asValueHolder.
itemFilterBlockHolder := nil asValueHolder.
doubleClickActionHolder := [ ] asValueHolder.
contextMenuHolder := nil asValueHolder.
Expand Down Expand Up @@ -208,7 +192,7 @@ AbstractListPresenter >> items: aCollection [
AbstractListPresenter >> listElementAt: anIndex [
"Return the item at index _anIndex_"

^ self model shownItems at: anIndex ifAbsent: [ nil ]
^ self model at: anIndex ifAbsent: [ nil ]
]

{ #category : #private }
Expand All @@ -224,7 +208,7 @@ AbstractListPresenter >> listSize [

"Return the size of the list"

^ self model shownItems size
^ self model size
]

{ #category : #accessing }
Expand Down Expand Up @@ -369,6 +353,11 @@ AbstractListPresenter >> whenActivatedDo: aBlockClosure [
activationBlock := aBlockClosure.
]

{ #category : #'api-events' }
AbstractListPresenter >> whenItemFilterBlockChangedDo: aBlock [
itemFilterBlockHolder whenChangedDo: aBlock
]

{ #category : #'api-events' }
AbstractListPresenter >> whenMenuChangedDo: aBlock [
"Set a block to value when the menu block has changed"
Expand Down
14 changes: 2 additions & 12 deletions src/Spec-Core/AbstractTextPresenter.class.st
Expand Up @@ -21,10 +21,10 @@ AbstractTextPresenter >> aboutToStyle: aBoolean [
"<api: #boolean getter: #isAboutToStyle registration: #whenAboutToStyleChanged:>"
"Set if the text zone must be styled"

"self
self
deprecated: 'This has been moved to specific presenters'
on: '2019-04-15'
in: #Pharo8"
in: #Pharo8
]

{ #category : #'api-shout' }
Expand Down Expand Up @@ -331,16 +331,6 @@ AbstractTextPresenter >> initialize [
self registerEvents
]

{ #category : #'api-shout' }
AbstractTextPresenter >> isAboutToStyle [
"Return if the text zone is shouted or not"

self
deprecated: 'This has been moved to specific presenters'
on: '2019-04-15'
in: #Pharo8
]

{ #category : #NOCompletion }
AbstractTextPresenter >> isCodeCompletionAllowed [
"Return if code completion is allowed"
Expand Down
7 changes: 6 additions & 1 deletion src/Spec-Core/AbstractTreeSingleSelectionMode.class.st
Expand Up @@ -45,11 +45,16 @@ AbstractTreeSingleSelectionMode >> replaceOtherSelectionMode: anotherSelection [
]

{ #category : #selection }
AbstractTreeSingleSelectionMode >> selectPath: pathArray [
AbstractTreeSingleSelectionMode >> selectPath: aPath [

self subclassResponsibility
]

{ #category : #selection }
AbstractTreeSingleSelectionMode >> selectPaths: pathArray [
self subclassResponsibility
]

{ #category : #selecting }
AbstractTreeSingleSelectionMode >> unselectAll [

Expand Down
24 changes: 17 additions & 7 deletions src/Spec-Core/CodePresenter.class.st
Expand Up @@ -9,7 +9,7 @@ Class {
'#doItContext => SpecObservableSlot',
'#doItReceiver => SpecObservableSlot',
'#behavior => SpecObservableSlot',
'#syntaxHighlight',
'#syntaxHighlight => SpecObservableSlot',
'#contextKeyBindings'
],
#category : #'Spec-Core-Widgets'
Expand Down Expand Up @@ -129,6 +129,11 @@ CodePresenter >> selectedBehavior [
^ self behavior
]

{ #category : #accessing }
CodePresenter >> syntaxHighlight: aBoolean [
syntaxHighlight := aBoolean
]

{ #category : #'api-events' }
CodePresenter >> whenBehaviorChangedDo: aBlock [
"Set a block to perform when the behavior class changed"
Expand All @@ -138,14 +143,19 @@ CodePresenter >> whenBehaviorChangedDo: aBlock [
whenChangedDo: aBlock
]

{ #category : #accessing }
CodePresenter >> withSyntaxHighlight [
{ #category : #'api-events' }
CodePresenter >> whenSyntaxHighlightChangedDo: aBlock [
"Set a block to perform when the syntax highlight is enabled/disabled"

syntaxHighlight := true
self property: #syntaxHighlight whenChangedDo: aBlock
]

{ #category : #accessing }
CodePresenter >> withoutSyntaxHighlight [
{ #category : #api }
CodePresenter >> withSyntaxHighlight [
self syntaxHighlight: true
]

syntaxHighlight := false
{ #category : #api }
CodePresenter >> withoutSyntaxHighlight [
self syntaxHighlight: false
]

0 comments on commit 050e413

Please sign in to comment.