-
Notifications
You must be signed in to change notification settings - Fork 85
Consistently frame the target element #2799
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
Conversation
We need it in each project we do snapshot testing in, but I'm unaware of a way to load it from anywhere but the current project's directory.
redwood-dom-testing/src/commonMain/kotlin/app/cash/redwood/dom/testing/DomSnapshotter.kt
Outdated
Show resolved
Hide resolved
| /** | ||
| * Configure the canvas that we will snapshot our element on. | ||
| */ | ||
| public class Frame( |
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.
Hmm I don't think this should live here. Or at least should immediately move after merging.
I think this should live in the shared test infrastructure so that each abstract test class can define their default frame (or even per-snapshot frames). This results in each platform producing images that are the same size and (should) look the same.
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.
Fantastic idea. Will do in follow-up.
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.
...d-dom-testing/src/commonTest/kotlin/app/cash/redwood/dom/testing/DomSnapshotterSampleTest.kt
Outdated
Show resolved
Hide resolved
Support a target element that isn't already a child of the document's root element. When snapshotting, wrap the element in a frame, and then remove the element from that frame afterwards. This avoids mutating the passed-in element as a side-effect of snapshotting.
9b8fb11 to
02c816a
Compare
Support a target element that isn't already a child of the document's root element.
When snapshotting, wrap the element in a frame, and then remove the element from that frame afterwards. This avoids mutating the passed-in element as a
side-effect of snapshotting.