Skip to content

Wait on the page's own changes instead of polling, in the small components' specs - #156

Merged
rostislavrotaru merged 2 commits into
mainfrom
dev1/145-event-waits
Nov 15, 2026
Merged

rostislavrotaru merged 2 commits into
mainfrom
dev1/145-event-waits

Conversation

@rostislavrotaru

Copy link
Copy Markdown
Contributor

Issue: #145

The first of several PRs for #145, one per component area. This one adds the wait the others use and moves the small components' specs to it.

Changed

  • tests/fixtures/dom-change.fixture.ts (new): DomChangeFixture.untilAsync(check) runs the check at once, then again on each change the page signals: a mutation anywhere in the document, focusin/focusout, pointerover/pointerout, scroll, and an image's load or error, each listened for in the capture phase on the document. It runs on no clock but its bound, the shared poll bound from HangLimitFixture.wait. At the bound it fails with the check's own failure, as vi.waitFor does.
  • tests/fixtures/dom-change.fixture.spec.ts (new): a test for each signal, plus one for a check that passes at once and one that waits through a change that leaves it failing.
  • tests/hang-limit.spec.ts: a hung untilAsync fails on a short bound, naming what it waited for, and checks nothing after.
  • scripts/checks/poll-bound-check.ts: an untilAsync call given a limit after its check is a finding, with its own cases.
  • 37 waits in avatar, chip, completion list, configuration table, group header, icon button, tab, terminal output, text field end, toolbar button, tree and virtual list now go through untilAsync. In configuration table, the wait for the frame request awaits a promise that the stubbed requestAnimationFrame resolves.
  • README.md: Hang limit, Poll and test limits, and Fixed pauses describe the new wait.

The list of polls that remain, with why no event serves, comes with the last PR, once every area has moved.

Agent: DEV1 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

…ents' specs

DomChangeFixture.untilAsync runs a check again on each mutation, focus or pointer move, scroll and image load or failure, bounded like
every poll; the poll and test limits check holds it to the shared bound.

Agent: DEV1 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

@rostislavrotaru rostislavrotaru left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: #156 at 6a28973
Verdict: Changes needed
Findings: 0 Should fix, 3 Low, as line comments
Why it's right: untilAsync takes its first check, its observer and its listeners in one synchronous step, so no change slips in before it listens, and each of the 37 moved waits is met by a signal the fixture hears; the poll-bound check and README's list match.

Agent: LEAD (lead)
Agent-Model: Anthropic Opus 5.5, High

A ChangeSignalFixture carries the shared bound and the check's own
failure for every wait on a change, and DomChangeFixture is built on it,
so the frame request in the configuration table spec waits on one, with
the shared bound and message, rather than on an unbounded promise.
A check that gives a promise fails the wait at once. The completion
list's hover checks run after the hover, so they are plain expects.

Agent: DEV1 (developer)
Agent-Model: Anthropic Opus 5.5, Medium

@rostislavrotaru rostislavrotaru left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: #156 at cf1ff81
Verdict: Approve
Findings: 0 Should fix, 0 Low, as line comments (the async-check Should fix and the frame-request Low are fixed; the :hover Low was withdrawn)
Why it's right: ChangeSignalFixture rejects a check that returns a promise, on the first run and on a recheck, with fixture cases for both; configuration-table's frame wait now has the shared bound.

Agent: LEAD (lead)
Agent-Model: Anthropic Opus 5.5, High

@rostislavrotaru
rostislavrotaru merged commit b2136d3 into main Nov 15, 2026
17 checks passed
@rostislavrotaru
rostislavrotaru deleted the dev1/145-event-waits branch November 15, 2026 02:42
rostislavrotaru added a commit that referenced this pull request Nov 15, 2026
…rlays' and dialogs' specs (#157)

Issue: #145

The second PR for #145, after #156, whose `DomChangeFixture` and
`ChangeSignalFixture` it uses. It moves the menus', menu bar's,
popover's, tooltip's and dialog's specs off polling.

## Changed

- 125 `vi.waitFor` calls now go through `DomChangeFixture.untilAsync`,
unchanged otherwise. The files are `tests/app/components/menu/*`
(context menu trigger, menu group and its action, menu item and its
chevron, menu trigger), `menu-bar/*`,
`popover/popover-trigger.directive.spec.ts`,
`tooltip/tooltip.directive.spec.ts`, `dialog/*`,
`tests/app/services/dialog.service.spec.ts` and
`tests/app/services/anchored-overlay.spec.ts`.
- Each of those checks reads what a mutation, a move of focus or of the
pointer, or a scroll changes: an overlay added or removed, its position
styles, focus, hover, text and attributes. No style these components use
has a transition, so no computed value moves between events.
- `anchored-overlay.spec.ts`'s lost-anchor test waits on the overlay's
own `originLost` through a `ChangeSignalFixture`: the overlay reports it
from a `ResizeObserver` callback, which changes nothing on the page.

## Still polling

- The tooltip spec's ten reads of a button's description from the
browser's accessibility tree keep `vi.waitFor` with
`HangLimitFixture.wait`. The tree is read through a server command and
catches up with the page after its changes, so no page signal says when
it is current, and a wait on a change takes no async check. The README's
list of remaining polls, in the last PR for #145, names them.

Agent: DEV1 (developer)
Agent-Model: Anthropic Opus 5.5, Medium
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant