This repository has been archived by the owner on Mar 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Accessibility): fix order of applying unhandled props and key han…
…dlers (#1901) * fix order of applying unhandled props and key handlers * UT and changelog * prettier * add test for correct merge order
- Loading branch information
1 parent
7860660
commit 770538e
Showing
10 changed files
with
88 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ReactWrapper } from 'enzyme' | ||
|
||
export const EVENT_TARGET_ATTRIBUTE = 'data-simulate-event-here' | ||
|
||
export const getEventTargetComponent = ( | ||
wrapper: ReactWrapper, | ||
listenerName: string, | ||
eventTargets?: object = {}, | ||
) => { | ||
const eventTarget = eventTargets[listenerName] | ||
? wrapper | ||
.find(eventTargets[listenerName]) | ||
.hostNodes() | ||
.first() | ||
: wrapper | ||
.find(`[${EVENT_TARGET_ATTRIBUTE}]`) | ||
.hostNodes() | ||
.first() | ||
|
||
// if (eventTarget.length === 0) { | ||
// throw new Error( | ||
// 'The event prop was not delegated to the children. You probably ' + | ||
// 'forgot to use `getUnhandledProps` util to spread the `unhandledProps` props.', | ||
// ) | ||
// } | ||
|
||
return eventTarget | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters