Conversation
dc092bc to
b8bd469
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #115 +/- ##
==========================================
+ Coverage 96.96% 97.03% +0.06%
==========================================
Files 9 9
Lines 330 337 +7
Branches 72 73 +1
==========================================
+ Hits 320 327 +7
Misses 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| if ('legacyRootSelector' in ComponentClass && ComponentClass.legacyRootSelector) { | ||
| componentRootSelector = `:is(.${ComponentClass.rootSelector}, .${ComponentClass.legacyRootSelector})`; | ||
| } | ||
| const componentRootSelector = getComponentRootSelector(ComponentClass); |
There was a problem hiding this comment.
Deduplicated this logic which exists for both dom and selectors
findClosest* test utilities
src/core/test/dom.test.ts
Outdated
|
|
||
| const nestedElements = document.createElement('div'); | ||
| nestedElements.innerHTML = ` | ||
| <div class="outer-component" data-id="outer"> |
There was a problem hiding this comment.
Should we call this data-testid to follow most of our other tests?
src/core/test/dom.test.ts
Outdated
| document.body.removeChild(nestedElements); | ||
| }); | ||
|
|
||
| it('returns the closest parent matching the component type', () => { |
There was a problem hiding this comment.
This does not really check the "closest parent matching the component type", as we currently only have one InnerWrapper. Can we test that too?
| const result = childWrapper.findClosestComponent(UnrelatedWrapper); | ||
| expect(result).toBeNull(); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
I'd suggest adding test coverage for sibling structures like:
<Component1>
<Component2 />
</Component1>
<Component3>
<Component4 />
</Component3>
When looking up the closest component for Component4 or Component3, the result should not match Component1 or Component2 as they're in a separate subtree
There was a problem hiding this comment.
And added a specific test for this in the latest commit
4998376 to
b0af06d
Compare
Issue:
D406188710Consuming packages fail as expected because the generated test utils do not match their snapshots. We will have to merge this PR following the instructions in
2ksIAPIa8aCiand update the snapshots in each of these consuming packages after that.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.