| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
PatternFly-React preview: https://patternfly-react-pr-2489.surge.sh |
Sorry, something went wrong.
| secondDropdownItem.simulate('keydown', { key: 'ArrowUp', keyCode: KEY_CODES.ARROW_UP, which: KEY_CODES.ARROW_UP }); | ||
| expect(firstDropdownItem === document.activeElement).toBe(true); | ||
| let focusedElement = document.activeElement; | ||
| expect(focusedElement.getAttribute('id')).toEqual('second'); |
There was a problem hiding this comment.
I would remove the initial expected focus item check from each of the tests. This makes each test depend on the previous test.
Sorry, something went wrong.
There was a problem hiding this comment.
Since there is no set-up or tear-down between each test case, they will depend on the previous test regardless. The following tests will fail if the DOM is not in the correct state. Maybe we should be initializing the DOM state from scratch on each test case?
Sorry, something went wrong.
There was a problem hiding this comment.
@jeff-phillips-18 what do you think?
Sorry, something went wrong.
There was a problem hiding this comment.
I think it's ok to just remove the init checks. The initial state is not handled by the utils and thus need not be tested here.
Sorry, something went wrong.
| secondDropdownItem.simulate('keydown', { key: 'ArrowUp', keyCode: KEY_CODES.ARROW_UP, which: KEY_CODES.ARROW_UP }); | ||
| expect(firstDropdownItem === document.activeElement).toBe(true); | ||
| let focusedElement = document.activeElement; | ||
| expect(focusedElement.getAttribute('id')).toEqual('second'); |
There was a problem hiding this comment.
Since there is no set-up or tear-down between each test case, they will depend on the previous test regardless. The following tests will fail if the DOM is not in the correct state. Maybe we should be initializing the DOM state from scratch on each test case?
Sorry, something went wrong.
Co-Authored-By: Jon Jackson <jonjacks@redhat.com>
Co-Authored-By: Jon Jackson <jonjacks@redhat.com>
There was a problem hiding this comment.
LGTM! 👍
Sorry, something went wrong.
There was a problem hiding this comment.
Jest is fun :) 👍
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
What: Closes #1624 and fixes keyHandler tests in util.test.js -- tests are now passing.