-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #231 from pharo-graphics/ItemListNodeDisable
Item list node disable
- Loading branch information
Showing
11 changed files
with
161 additions
and
5 deletions.
There are no files selected for viewing
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
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,5 @@ | ||
Class { | ||
#name : #ToBarNodeHolderForTest, | ||
#superclass : #ToBarNodeHolder, | ||
#category : #'Toplo-Widget-List-Tests-ItemList' | ||
} |
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,25 @@ | ||
Class { | ||
#name : #ToItemElementForTest, | ||
#superclass : #ToElement, | ||
#traits : 'TToItem', | ||
#classTraits : 'TToItem classTrait', | ||
#instVars : [ | ||
'label' | ||
], | ||
#category : #'Toplo-Widget-List-Tests-ItemList' | ||
} | ||
|
||
{ #category : #initialization } | ||
ToItemElementForTest >> initialize [ | ||
|
||
super initialize. | ||
label := ToLabel new. | ||
self addChild: label. | ||
self fitContent | ||
] | ||
|
||
{ #category : #accessing } | ||
ToItemElementForTest >> text: aText [ | ||
|
||
label text: aText | ||
] |
11 changes: 11 additions & 0 deletions
11
src/Toplo-Widget-List-Tests/ToItemListElementForTest.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,11 @@ | ||
Class { | ||
#name : #ToItemListElementForTest, | ||
#superclass : #ToItemListElement, | ||
#category : #'Toplo-Widget-List-Tests-ItemList' | ||
} | ||
|
||
{ #category : #initialization } | ||
ToItemListElementForTest >> defaultNodeManagerClass [ | ||
|
||
^ ToItemNodeManagerForTest | ||
] |
67 changes: 67 additions & 0 deletions
67
src/Toplo-Widget-List-Tests/ToItemListElementTest.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,67 @@ | ||
" | ||
A ToItemListElementTest is a test class for testing the behavior of ToItemListElement | ||
" | ||
Class { | ||
#name : #ToItemListElementTest, | ||
#superclass : #ToParameterizedHostTest, | ||
#instVars : [ | ||
'l' | ||
], | ||
#category : #'Toplo-Widget-List-Tests-ItemList' | ||
} | ||
|
||
{ #category : #running } | ||
ToItemListElementTest >> setUp [ | ||
|
||
super setUp. | ||
l := ToItemListElementForTest new. | ||
l vMatchParent. | ||
space root addChild: l | ||
] | ||
|
||
{ #category : #tests } | ||
ToItemListElementTest >> test [ | ||
|
||
| n | | ||
self assert: l nodes size equals: l dataAccessor size. | ||
self assert: (l nodeManager isKindOf: ToItemNodeManagerForTest). | ||
l dataAccessor addAll: | ||
((1 to: 10) collect: [ :i | ToItemElementForTest new text: i asString ]). | ||
n := l nodes first. | ||
self assert: (n isKindOf: ToItemNodeForTest). | ||
self assert: (n holder isKindOf: ToBarNodeHolderForTest). | ||
self assert: (n holder dataItem isKindOf: ToItemElementForTest) | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
ToItemListElementTest >> testDisableItemAfterAdding [ | ||
|
||
| n item | | ||
self skip. | ||
self assert: l nodes size equals: 0. | ||
item := ToItemElementForTest new text: 'A'. | ||
l dataAccessor add: item. | ||
item disable. | ||
n := l nodes first. | ||
self waitTestingSpaces. | ||
self assert: n holder dataItem identicalTo: item. | ||
self assert: item isDisabled. | ||
self assert: n isDisabled | ||
] | ||
|
||
{ #category : #tests } | ||
ToItemListElementTest >> testDisableItemBeforeAdding [ | ||
|
||
| n item | | ||
self skip. | ||
self assert: l nodes size equals: 0. | ||
item := ToItemElementForTest new text: 'A'. | ||
item disable. | ||
l dataAccessor add: item. | ||
n := l nodes first. | ||
self waitTestingSpaces. | ||
self assert: n holder dataItem identicalTo: item. | ||
self assert: item isDisabled. | ||
self assert: n isDisabled | ||
] |
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,5 @@ | ||
Class { | ||
#name : #ToItemNodeForTest, | ||
#superclass : #ToItemNode, | ||
#category : #'Toplo-Widget-List-Tests-ItemList' | ||
} |
23 changes: 23 additions & 0 deletions
23
src/Toplo-Widget-List-Tests/ToItemNodeManagerForTest.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 : #ToItemNodeManagerForTest, | ||
#superclass : #ToItemNodeManager, | ||
#category : #'Toplo-Widget-List-Tests-ItemList' | ||
} | ||
|
||
{ #category : #initialization } | ||
ToItemNodeManagerForTest >> defaultFakeDataItem [ | ||
|
||
^ ToItemElementForTest new text: 'X' | ||
] | ||
|
||
{ #category : #'instance creation' } | ||
ToItemNodeManagerForTest >> newHolder [ | ||
|
||
^ ToBarNodeHolderForTest new | ||
] | ||
|
||
{ #category : #'instance creation' } | ||
ToItemNodeManagerForTest >> newNodeForHolder: aNodeHolder [ | ||
|
||
^ ToItemNodeForTest new | ||
] |
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
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
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
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