Skip to content

Conversation

swankjesse
Copy link
Collaborator

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.

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.
/**
* Configure the canvas that we will snapshot our element on.
*/
public class Frame(
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

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.
Base automatically changed from jwilson.0908.snapshot-testing-file to trunk September 9, 2025 19:36
@swankjesse swankjesse force-pushed the jwilson.0909.fixup_frames branch from 9b8fb11 to 02c816a Compare September 9, 2025 19:58
@swankjesse swankjesse merged commit b43a265 into trunk Sep 9, 2025
14 checks passed
@swankjesse swankjesse deleted the jwilson.0909.fixup_frames branch September 9, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants