-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
STATUS-1: needs triageNew issue which needs to be triagedNew issue which needs to be triagedTYPE: bugSomething isn't workingSomething isn't working
Description
Which component is affected?
Qwik Rollup / Vite plugin
Describe the bug
I'm trying to trigger a click on a checkbox in a vitest using userEvent
doesn't change the checked
value of a checkbox
import { createDOM } from '@builder.io/qwik/testing';
import { test, expect } from 'vitest';
import { Checkbox } from './checkbox';
test(`Should select / deselect (but doesn't)`, async () => {
const { screen, render, userEvent } = await createDOM();
await render(<Checkbox variant="action" />);
const selector = 'input[type="checkbox"]';
const checkbox = screen.querySelector(selector) as HTMLInputElement;
expect(checkbox.checked).toBeFalsy();
await userEvent(selector, 'click'); // doesn't work
// await userEvent(checkbox, 'click'); // doesn't work
// await userEvent('input[type="checkbox"]', 'click'); // doesn't work
// await userEvent(screen.querySelector(selector) as HTMLInputElement, 'click'); // doesn't work
expect(checkbox.checked).toBeTruthy(); // fails
});
replacing userEvent(selector, 'click')
with screen.querySelector(selector).click()
works as expected
Reproduction
Steps to reproduce
npm install
+ npm run test.unit
on reproduction repo shows the passing and failing tests
System Info
System:
OS: macOS 13.5.2
CPU: (10) arm64 Apple M1 Pro
Memory: 1.35 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.16.0/bin/yarn
npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
Browsers:
Brave Browser: 117.1.58.127
Chrome: 117.0.5938.92
Firefox: 116.0.3
Safari: 16.6
npmPackages:
@builder.io/qwik: ^1.2.12 => 1.2.12
@builder.io/qwik-city: ^1.2.12 => 1.2.12
undici: 5.22.1 => 5.22.1
vite: 4.4.7 => 4.4.7
Additional Information
No response
Metadata
Metadata
Assignees
Labels
STATUS-1: needs triageNew issue which needs to be triagedNew issue which needs to be triagedTYPE: bugSomething isn't workingSomething isn't working