mirror of
https://github.com/jlengrand/open-wc.git
synced 2026-03-10 08:31:19 +00:00
fix(testing-helpers): add time before triggering focus/blur (only IE)
This commit is contained in:
@@ -58,6 +58,10 @@ export function nextFrame() {
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function triggerBlurFor(element) {
|
||||
if (isIE()) {
|
||||
await nextFrame();
|
||||
await nextFrame();
|
||||
}
|
||||
element.blur();
|
||||
if (isIE()) {
|
||||
await nextFrame();
|
||||
@@ -67,11 +71,17 @@ export async function triggerBlurFor(element) {
|
||||
|
||||
/**
|
||||
* Resolves after focus.
|
||||
* Adding an event and immediately trigger it in fails in IE.
|
||||
* Also before checking the effects of a trigger IE needs some time.
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @returns {Promise<void>}
|
||||
*/
|
||||
export async function triggerFocusFor(element) {
|
||||
if (isIE()) {
|
||||
await nextFrame();
|
||||
await nextFrame();
|
||||
}
|
||||
element.focus();
|
||||
if (isIE()) {
|
||||
await nextFrame();
|
||||
|
||||
Reference in New Issue
Block a user