-
Notifications
You must be signed in to change notification settings - Fork 51
Fix odd test bug #381
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
Fix odd test bug #381
Conversation
|
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
9063ccc to
7e7d6a7
Compare
2e02de1 to
3f68ce5
Compare
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.
Thanks for investigating this! I've also spent some time yesterday trying to replicate the issue locally but no luck.
| let clicked = false; | ||
| this.set('clickHandler', () => (clicked = true)); | ||
| await render( | ||
| hbs`<div {{on "click" this.clickHandler}}><Hds::Interactive @href="javascript:;" id="test-interactive"/></div>` |
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.
So we rely on the click event bubbling up, then capture it at the parent level using a boolean. Given we only use sinon for this test I'm happy with the change. We may get back to square one if we won't manage to use this pattern for future scenarios, but that's a problem for tomorrow.
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.
We may get back to square one if we won't manage to use this pattern for future scenarios
That was my fear with "fixing" it this way as well.
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.
![]()
📌 Summary
Fixes #358
Refactors a single test to avoid an odd bug in our test suite
🛠️ Detailed description
After some sleuthing 🕵️ I found out how to reproduce the issue (in CI, never locally 🤷 )
design-system/packages/components/tests/integration/components/hds/interactive/index-test.js
Lines 133 to 139 in cb38390
I'm a bit rusty, but I made a pass at refactoring this test to not use sinon and a) the test "works" and b) the errors are no longer present in our CI runs if you look at one of the tests for components.
Ideally we could understand why this test was causing this in the event we want to add sinon back in the future but I've hit my timebox limit on this for now. My suspicion is that the sinon usage was causing some hidden error that sent things astray.
👀 How to review
👉 Review commit-by-commit
Reviewer's checklist:
💬 Please consider using conventional comments when reviewing this PR.