Skip to content

Commit

Permalink
fix: fix userEvent.select and deselect to work in new versions of hap…
Browse files Browse the repository at this point in the history
…py-dom
  • Loading branch information
aralroca committed Dec 14, 2024
1 parent 11e8b6f commit 9acb26c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/brisa/src/core/test/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,17 +241,15 @@ export const userEvent = {
},
select: (select: HTMLSelectElement, value: string) => {
select.value = value;
// Note: Dispatching 'input' event is also dispatching 'change' event
// in Happy-DOM, so we don't need to dispatch 'change' event separately
select.dispatchEvent(new Event('input', { bubbles: true }));
select.dispatchEvent(new Event('change', { bubbles: true }));
},
deselect: (selecgt: HTMLSelectElement, value: string) => {
if (value === selecgt.value) {
selecgt.value = '';
deselect: (select: HTMLSelectElement, value: string) => {
if (value === select.value) {
select.value = '';
}
// Note: Dispatching 'input' event is also dispatching 'change' event
// in Happy-DOM, so we don't need to dispatch 'change' event separately
selecgt.dispatchEvent(new Event('input', { bubbles: true }));
select.dispatchEvent(new Event('input', { bubbles: true }));
select.dispatchEvent(new Event('change', { bubbles: true }));
},
upload: (input: HTMLInputElement, file: File) => {
// @ts-ignore
Expand Down

0 comments on commit 9acb26c

Please sign in to comment.