forked from testing-library/user-event
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: button trigger space (testing-library#409)
- Loading branch information
1 parent
6d7ec76
commit 1d57a79
Showing
10 changed files
with
675 additions
and
329 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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import {fireEvent} from '@testing-library/dom' | ||
import {getActiveElement, isFocusable, eventWrapper} from './utils' | ||
|
||
function blur(element, init) { | ||
function blur(element) { | ||
if (!isFocusable(element)) return | ||
|
||
const wasActive = getActiveElement(element.ownerDocument) === element | ||
if (!wasActive) return | ||
|
||
eventWrapper(() => element.blur()) | ||
fireEvent.focusOut(element, init) | ||
} | ||
|
||
export {blur} |
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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import {fireEvent} from '@testing-library/dom' | ||
import {getActiveElement, isFocusable, eventWrapper} from './utils' | ||
|
||
function focus(element, init) { | ||
function focus(element) { | ||
if (!isFocusable(element)) return | ||
|
||
const isAlreadyActive = getActiveElement(element.ownerDocument) === element | ||
if (isAlreadyActive) return | ||
|
||
eventWrapper(() => element.focus()) | ||
fireEvent.focusIn(element, init) | ||
} | ||
|
||
export {focus} |
Oops, something went wrong.