passsy / spot

Chainable powerful Flutter widget selector API, screenshots and assertions for awesome widget tests.
https://pub.dev/packages/spot
Apache License 2.0
63 stars 2 forks source link

withChild/withParent #21

Closed passsy closed 1 year ago

passsy commented 1 year ago

Once a selector is saved in a variable, parent and child relationships can't be easily adjusted. It was always possible with copyWith, but now there's an explicit API

final containers = spot<Container>();
containers.existsExactlyNTimes(3);

containers.withParent(spot<Wrap>()).existsOnce();
containers.withParents([spot<Wrap>()]).existsOnce();

containers.withChild(spot<Wrap>()).existsOnce();
containers.withChildren([spot<Wrap>()]).existsOnce();