Repository navigation
Releases: shadowjs-dev/testing
Releases · shadowjs-dev/testing
Release list
1.0.3
Fixed
userEvent.type,clear,keyboardandselectOptionsdo nothing on disabled controls, read-only fields and disabled options (no value change, no input events).userEvent.click,pointer,dblClickandtabuse the matchers' disabled check (disabled fieldset ancestry); a straydisabledattribute on adivno longer blocks a click.toHaveStyle("...")splits declarations outside quotes and parentheses and at the first:, and throws aTypeErrorfor a declaration or text that does not parse.toBeVisibletreatsopacity: 0and the content of a closed<details>(other than its<summary>) as hidden.toHaveTextContent("")passes only for an element with no text.toHaveTextContent,toHaveAccessibleNameandtoHaveAccessibleDescriptiongive the same answer on every call for agoryregular expression.
1.0.2
Fixed
render()andrenderDirective()remove the container or element they appended when the UI, the directive or its first effect throws (they leaked into the document), andrender({ hydrate: true })without acontainerthrows before it appends anything.userEvent.keyboard("{Tab}")dispatches onekeydowninstead of two and sends thekeyupto the element that received focus.toBeDisabled()andtoBeEnabled()apply to form controls and custom elements only (adivinside a disabledfieldsetis not disabled) and spare the controls in the firstlegendof a disabledfieldset.waitForworks with Vitest's fake timers (vi.useFakeTimers()): each poll advances the fake clock by oneintervalinstead of waiting on a clock that never moves, andtimeoutcounts fake milliseconds. It finds the fake clock onsetTimeoutitself, so nothing is imported fromvitest.findBy*andfindAllBy*(onscreen,withinand a render result) andwaitForElementToBeRemovedwork with Vitest's fake timers likewaitFor, and acontainerpassed in their wait options now picks the DOM snapshot in the timeout error, as in Testing Library.startApptakesreadyMatch(text or pattern): the body of thereadyPathanswer must match it, so another process that took the port is not mistaken for the app. An app that ended while the probe was in flight is reported as ended, not ready.freePort(and sostartApp) picks a random port from 20000 up to 45000 that it can listen on on the givenhost, and never returns the same port twice in a process, instead of asking the system for port 0: the next ephemeral port is the pool every outbound socket draws from, so another connection could take it before the app started. It rejects at once with the listen error when the host cannot be bound, and after 64 busy ports with an error that names the range.
1.0.1
Changed
- Released at 1.0.1 with the other packages, which share one version. No change to this package.
1.0.0
Added
- Render, hydrate, DOM queries and automatic root cleanup for component tests.
- User-event helpers and utilities for testing effects, hooks and directives.
@shadow-js/testing/playwright:waitForHydration(thedusk:hydratedmark),collectProblems
(console errors and warnings, page errors, failed requests, 4xx/5xx answers),clientNavigate
(follows a link and fails on a full document load),startAppandfreePort(the app under test on a
free port, stopped withSIGINTthenSIGKILL), andcreateTest, which adds theapp,problems
andhydratedfixtures to a@playwright/testtest.playwright-coreis an optional peer
dependency; the entry imports no Playwright package.