Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix userEvent.select and deselect to work in new versions of happy-dom #681

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading