sui-components
sui-components copied to clipboard
test(components/molecule/select): fix flaky onblur test
Category/Component
TASK:
Types of changes
- [x] ๐ชฒ Bug fix (non-breaking change which fixes an issue)
- [ ] โจ New feature (non-breaking change which adds functionality)
- [ ] ๐ฅ Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] ๐งพ Documentation
- [ ] ๐ท Demo
- [x] ๐งช Test
- [ ] ๐ง Refactor
- [ ] ๐ Styles
Description, Motivation and Context
Avoid weird race condition with userEvent.tab() by firing focusIn and focusOut events
Screenshots - Animations
| STATEMENTS | BRANCHES | FUNCTIONS | LINES | |
|---|---|---|---|---|
| โ | โ 0.45โ | โ 0.42โ | โ 0.61โ | โ 0.61โ |
| % | 71.65 | 57.36 | 58.95 | 73.42 |
| ABS | 2659 / 3711 | 1495 / 2606 | 484 / 821 | 2564 / 3492 |
| STATEMENTS | BRANCHES | FUNCTIONS | LINES | |
|---|---|---|---|---|
| โ | โ 0.45โ | โ 0.42โ | โ 0.61โ | โ 0.61โ |
| % | 71.65 | 57.36 | 58.95 | 73.42 |
| ABS | 2659 / 3711 | 1495 / 2606 | 484 / 821 | 2564 / 3492 |
Merging this PR.
We are aware that there are some issues with focusing in and out of the Karma browser when running the tests. This is why firing an event directly seemed to fix the test. As a temporary workaround we're using fireEvent to trigger the blur event from the node