From d9a37f31d0888c1cb17c12869a148cb47eaf1c1d Mon Sep 17 00:00:00 2001 From: Stacey Van Herk <13419300+svanherk@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:20:02 -0400 Subject: [PATCH] fix: Expose oneDefaultPreventedEvent from open-wc/testing (#151) --- README.md | 2 ++ src/browser/index.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e5249643..97a1c469 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,8 @@ it('should wait for an event', async() => { Note that the call to `clickElem` is not `await`-ed, since by the time it resolves the event will have already been dispatched. +If you need to prevent the default behaviour of the event in your test, you can use `oneDefaultPreventedEvent`. + #### Waiting for a Lit Element to Update When using Lit-based components, it's common to create a fixture and then modify some of its properties, which usually requires waiting for those changes to be rendered. diff --git a/src/browser/index.js b/src/browser/index.js index ec084456..320ea2f8 100644 --- a/src/browser/index.js +++ b/src/browser/index.js @@ -1,5 +1,5 @@ import './vdiff.js'; -export { assert, aTimeout, defineCE, expect, html, nextFrame, oneEvent, waitUntil } from '@open-wc/testing'; +export { assert, aTimeout, defineCE, expect, html, nextFrame, oneDefaultPreventedEvent, oneEvent, waitUntil } from '@open-wc/testing'; export { clickAt, clickElem, focusElem, hoverAt, hoverElem, sendKeys, sendKeysElem } from './commands.js'; export { fixture } from './fixture.js';