Skip to content
Permalink
Browse files

Merge pull request #665 from Ducasse/664-SpTestingComposerWithModel-i…

…nto-SpTestingPresenterWithModel

664-SpTestingComposerWithModel-into-SpTestingPresenterWithModel
  • Loading branch information...
jecisc committed Jul 24, 2019
2 parents c630a0e + bd401fa commit 092e6c415cb118f53973ed59011f320a97c7c3a1
@@ -10,7 +10,7 @@ SpComposablePresenterWithModelTest >> testInstanceCreation [
| aPoint presenter |

aPoint := 40@54.
presenter := SpTestingComposablePresenterWithModel on: aPoint.
presenter := SpTestingPresenterWithModel on: aPoint.

self assert: presenter model equals: aPoint.
self deny: (aPoint dependents includes: presenter).
@@ -26,7 +26,7 @@ SpComposablePresenterWithModelTest >> testInstanceCreationWithValueHolder [

point := (40@54).
valueHolder := point asValueHolder.
presenter := SpTestingComposablePresenterWithModel on: valueHolder.
presenter := SpTestingPresenterWithModel on: valueHolder.

self assert: presenter model equals: point.

@@ -42,7 +42,7 @@ SpComposablePresenterWithModelTest >> testModelSettingModelToModel [
| model model2 presenter |
model := SpTestingPointModel x: 1 y: 2.
model2 := SpTestingPointModel x: 4 y: 5.
presenter := SpTestingComposablePresenterWithModel on: model.
presenter := SpTestingPresenterWithModel on: model.
self assert: presenter announcingObject isSpAnnouncingObject.
self deny: presenter announcingObject isValueHolder.
self assert: model2 isSpAnnouncingObject.
@@ -63,7 +63,7 @@ SpComposablePresenterWithModelTest >> testModelSettingModelToValueHolder [
"we had value holder, new model is a model"
point := 40@54.

presenter := SpTestingComposablePresenterWithModel on: point.
presenter := SpTestingPresenterWithModel on: point.
model := SpTestingPointModel x: 1 y: 2.
self assert: presenter announcingObject isSpAnnouncingObject.
self assert: presenter announcingObject isValueHolder.
@@ -86,7 +86,7 @@ SpComposablePresenterWithModelTest >> testModelSettingObjectToModel [
"we had a Model, new model is a regular object"
model := SpTestingPointModel x: 1 y: 2.
point := 40@54.
presenter := SpTestingComposablePresenterWithModel on: model.
presenter := SpTestingPresenterWithModel on: model.
self assert: presenter announcingObject isSpAnnouncingObject.
self deny: presenter announcingObject isValueHolder.
self deny: point isSpAnnouncingObject.
@@ -109,7 +109,7 @@ SpComposablePresenterWithModelTest >> testModelSettingObjectToValueHolder [
"we had value holder, new model is a regular object"
point := 40@54.
point2 := 1@0.
presenter := SpTestingComposablePresenterWithModel on: point.
presenter := SpTestingPresenterWithModel on: point.
self assert: presenter announcingObject isSpAnnouncingObject.
self assert: presenter announcingObject isValueHolder.
self deny: point2 isSpAnnouncingObject.
@@ -130,7 +130,7 @@ SpComposablePresenterWithModelTest >> testModelSettingValueHolderToModel [
point := 1@0.
model := SpTestingPointModel x: 1 y: 2.
valueHolder := NewValueHolder value: point.
presenter := SpTestingComposablePresenterWithModel on: model.
presenter := SpTestingPresenterWithModel on: model.
self assert: presenter announcingObject isSpAnnouncingObject.
self deny: presenter announcingObject isValueHolder.
self assert: valueHolder isSpAnnouncingObject.
@@ -153,7 +153,7 @@ SpComposablePresenterWithModelTest >> testModelSettingValueHolderToValueHolder [
point2 := 1@0.

"we had value holder, new model is a value holder"
presenter := SpTestingComposablePresenterWithModel on: point.
presenter := SpTestingPresenterWithModel on: point.
valueHolder := NewValueHolder value: point2.
self assert: presenter announcingObject isSpAnnouncingObject.
self assert: presenter announcingObject isValueHolder.
@@ -174,7 +174,7 @@ SpComposablePresenterWithModelTest >> testUpdateModel [
| aPoint presenter |

aPoint := SpTestingPointModel x: 40 y: 54.
presenter := SpTestingComposablePresenterWithModel on: aPoint.
presenter := SpTestingPresenterWithModel on: aPoint.

self assert: presenter x text equals: aPoint x asString.
self assert: presenter y text equals: aPoint y asString.
@@ -204,7 +204,7 @@ SpComposablePresenterWithModelTest >> testUpdateModelWithValueHolder [
anAnnouncer := aValueHolder announcer.
self assert: (aValueHolder announcer subscriptions subscriptions size) equals: 0.

presenter := SpTestingComposablePresenterWithModel on: aValueHolder.
presenter := SpTestingPresenterWithModel on: aValueHolder.

self assert: (anAnnouncer == aValueHolder announcer).
self assert: presenter x text equals: aPoint x asString.
@@ -1,8 +1,13 @@
"
A testing composable presenter for testing of the class ComposablePresenterWithModel
A testing presenter for testing of the class SpPresenterWithModel
| model presenter |
model := SpTestingPointModel x: 1 y: 2.
presenter := SpTestingPresenterWithModel on: model.
presenter openWithSpec
"
Class {
#name : #SpTestingComposablePresenterWithModel,
#name : #SpTestingPresenterWithModel,
#superclass : #SpPresenterWithModel,
#instVars : [
'x',
@@ -12,58 +17,58 @@ Class {
}

{ #category : #specs }
SpTestingComposablePresenterWithModel class >> defaultSpec [
SpTestingPresenterWithModel class >> defaultSpec [
^ SpBoxLayout newHorizontal
add: #x;
add: #y;
yourself
]

{ #category : #specs }
SpTestingComposablePresenterWithModel class >> open [
SpTestingPresenterWithModel class >> open [

<example>

(self on: 1@2) openWithSpec
]

{ #category : #initialization }
SpTestingComposablePresenterWithModel >> initializeWidgets [

SpTestingPresenterWithModel >> initializeWidgets [
x := self newTextInput.
y := self newTextInput.
]

{ #category : #initialization }
SpTestingComposablePresenterWithModel >> modelChanged [
SpTestingPresenterWithModel >> modelChanged [

x text: self model x asString.
y text: self model y asString.

]

{ #category : #api }
SpTestingComposablePresenterWithModel >> title [
SpTestingPresenterWithModel >> title [

^ 'Point'
]

{ #category : #accessing }
SpTestingComposablePresenterWithModel >> x [
SpTestingPresenterWithModel >> x [
^ x
]

{ #category : #accessing }
SpTestingComposablePresenterWithModel >> x: anObject [
SpTestingPresenterWithModel >> x: anObject [
x := anObject
]

{ #category : #accessing }
SpTestingComposablePresenterWithModel >> y [
SpTestingPresenterWithModel >> y [
^ y
]

{ #category : #accessing }
SpTestingComposablePresenterWithModel >> y: anObject [
SpTestingPresenterWithModel >> y: anObject [
y := anObject
]

0 comments on commit 092e6c4

Please sign in to comment.
You can’t perform that action at this time.