Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix should serialized #1

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Toplo-Serialization/ToElement.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Extension { #name : #ToElement }
ToElement >> shouldSerializedChildren [
"Toplo elements should not serialize children by default. Manage exeptions in subclasses."

^ false
^ (self class == ToElement)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why class == ToElement? What it's happen for ToButton class for example? It is a ToElement but class ~= ToElement. It need to save children?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok this is related to your comment below:

"Toplo-Serialization -> If we have a ToElement, it should serialized itt's children. If we have anything with TToPlaceHolder trait it should serialize it's children. Everithing else should not serialize it's children."

Ok so all subclasses of ToElement NOT serialize children.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in the examples of Toplo the ToElement is often used as a container. I consider a ToElement to be a container and all subclasses to be a "leaf"

]

{ #category : #'*Toplo-Serialization' }
Expand Down
6 changes: 3 additions & 3 deletions src/Toplo-Serialization/ToSerializerTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ ToSerializerTest >> testIsLeaf4 [
yourself.
b1 addChild: b2.

self deny: b1 shouldSerializedChildren.
self assert: b1 shouldSerializedChildren.
self assert: b1 id equals: #b1.
self assert: b1 childrenCount equals: 1.

element := b1 serializeThenMaterialize.
self deny: element shouldSerializedChildren.
self assert: element shouldSerializedChildren.
self assert: element id equals: #b1.
self assert: element childrenCount equals: 0.
self assert: element childrenCount equals: 1.
]

{ #category : #tests }
Expand Down
Loading