-
Notifications
You must be signed in to change notification settings - Fork 143
Conversation
Fragments can not be used directly as children of a component: local function component() return Roact.createElement("Frame", {}, { fragments = Roact.createFragment({ A = Roact.createElement("Frame", {}, {}) }) }) end Turning Fragments into Elements make them have their own virtual node, so they can be reconciled as any other nodes.
For testing, I think it should be possible to use the Look at some of the other tests in As for what cases to test, I'd just try combinations of places you can put fragments? An element with fragments in its children is a good start. I'd also test things that will have name duplication and make sure they work out correctly, but those tests are more involved. |
Closing and re-opening to trigger CI checks. |
src/RobloxRenderer.spec.lua
Outdated
return createElement("StringValue", { | ||
Value = "B", | ||
}) | ||
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these needs to be spies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think they need, I could have asserted that they were called, but instead I removed them and asserted that the values are correctly created
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more thing we should add is a changelog entry (this change is significant enough to warrant it). You should get an idea of what it would look like based on the existing entries (you can add it to the "Unreleased" section)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than my suggestion for rewording changelog, this looks good to me! If @LPGhatguy agrees, we should merge after the changelog fix!
Co-Authored-By: Paul Doyle <37384169+ZoteTheMighty@users.noreply.github.com>
src/RobloxRenderer.spec.lua
Outdated
return createElement("StringValue", { | ||
Value = "B", | ||
}) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need these components at all?
If we do, we should define them using local function ChildA() ... end
and such to line up with conventions for declaring function components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Closes #205
Fragments can now be used directly as children of a component:
Turning Fragments into Elements make them have their own virtual node, so they can be reconciled as any other nodes.
I'm not so sure about how to write good tests for that, let me know what's the best way (not sure where to assert exactly).
Checklist before submitting:
CHANGELOG.md