This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3efdca5
commit 0c0de8f
Showing
4 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
src/Spec-Brick-Tests/SpBrickTextInputFieldAdapterTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Class { | ||
#name : #SpBrickTextInputFieldAdapterTest, | ||
#superclass : #SpBrickWidgetAdapterTest, | ||
#category : #'Spec-Brick-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
SpBrickTextInputFieldAdapterTest >> specWidgetClass [ | ||
|
||
^ SpTextInputFieldPresenter | ||
] | ||
|
||
{ #category : #tests } | ||
SpBrickTextInputFieldAdapterTest >> testText [ | ||
|
||
specWidget text: 'Hello Brick'. | ||
self assert: specWidget text asString equals: 'Hello Brick'. | ||
|
||
brickWidget text: 'Hello Spec' asRopedText. | ||
" self waitUI." | ||
self assert: specWidget text asString equals: 'Hello Spec'. | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Class { | ||
#name : #BrOneLineInputFilter, | ||
#superclass : #BrTextEditorInputFilter, | ||
#category : #'Spec-Brick' | ||
} | ||
|
||
{ #category : #accessing } | ||
BrOneLineInputFilter >> filter: aString [ | ||
<return: #String> | ||
|
||
^ aString reject: #isLineSeparator | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Class { | ||
#name : #SpBrickAbstractTextAdapter, | ||
#superclass : #SpBrickWidgetAdapter, | ||
#category : #'Spec-Brick' | ||
} | ||
|
||
{ #category : #'widget creation' } | ||
SpBrickAbstractTextAdapter >> subscribeToPresenter [ | ||
|
||
self presenter | ||
whenTextChangedDo: [ self updateText ]; | ||
whenPlaceholderChangedDo: [ self halt ]; | ||
whenAcceptBlockChangedDo: [ self halt ]; | ||
yourself | ||
] | ||
|
||
{ #category : #'widget creation' } | ||
SpBrickAbstractTextAdapter >> subscribeToWidget [ | ||
|
||
widget | ||
addEventHandlerOn: "BrEditorTextChanged"BrTextEditorModifiedEvent | ||
do: [ self updateText ] | ||
] | ||
|
||
{ #category : #'widget update' } | ||
SpBrickAbstractTextAdapter >> updateAll [ | ||
|
||
self updateText. | ||
] | ||
|
||
{ #category : #'widget update' } | ||
SpBrickAbstractTextAdapter >> updateText [ | ||
|
||
self subclassResponsibility | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Class { | ||
#name : #SpBrickTextInputFieldAdapter, | ||
#superclass : #SpBrickAbstractTextAdapter, | ||
#category : #'Spec-Brick' | ||
} | ||
|
||
{ #category : #'widget creation' } | ||
SpBrickTextInputFieldAdapter >> buildWidget [ | ||
|
||
^ BrEditor new | ||
aptitude: BrGlamorousRegularEditorAptitude; | ||
inputFilter: BrOneLineInputFilter new; | ||
vFitContent; | ||
yourself | ||
] | ||
|
||
{ #category : #'widget update' } | ||
SpBrickTextInputFieldAdapter >> updateText [ | ||
|
||
self widgetDo: [ :w | w text: self presenter text ] | ||
] |