Skip to content

test(#473): assert the variable toolbar's real display contract - #556

Merged
BorisTyshkevich merged 2 commits into
mainfrom
test/e2e-has-variables-473
Jul 29, 2026
Merged

test(#473): assert the variable toolbar's real display contract#556
BorisTyshkevich merged 2 commits into
mainfrom
test/e2e-has-variables-473

Conversation

@BorisTyshkevich

Copy link
Copy Markdown
Collaborator

What & why

Closes #473. The mobile Dashboard e2e fixture rendered a has-variables class on the variable toolbar that the app never sets, and two specs located the toolbar through it — so they passed against hand-written markup rather than the app's own contract. src/styles.css has no .has-variables rule and never had a .has-filters one.

Per the owner decision, this re-fixtures to the app's real contract rather than teaching ui/dashboard.ts to set the class: no app markup or CSS change. The fixture now carries exactly the two classes src/ui/dashboard.ts builds (dash-toolbar dash-toolbar-variables), and both specs assert the real show/hide mechanism — the inline style.display.

Closing the gap the issue actually named

#473 warns that "a regression in how the toolbar is actually hidden (or shown) would not be caught". Re-pointing the e2e selectors alone would not have fixed that, because the fixture is hand-written markup — asserting style.display on a static <div> proves nothing about the app.

src/ui/dashboard.ts builds the toolbar with style: hasOrdinaryVariables ? undefined : { display: 'none' }. The hidden branch was already covered against a real createApp render; the shown branch was not, so inverting that ternary left the whole suite green. This adds the missing unit assertion, so both branches are now falsifiable.

Sabotage-verified both ways: flipping the ternary turns the hidden-branch test and the new shown-branch test red; forcing display: none onto the fixture turns both re-pointed e2e specs red. Sources restored by writing the saved bytes back, not git checkout --.

Both specs still test their original subjects (a fixed-position combobox popover escaping toolbar-clip bounds, and constant row height while scrolling variables) — the toolbar is a bounding-rect anchor in each, now also carrying the visibility check.

Checklist

  • npm test passes (the per-file coverage gate is non-negotiable)
  • Tests added/updated in the same change as the code
  • npm run build succeeds (single-file dist/sql.html)
  • Layers kept honest: pure logic in src/core/, network in src/net/ (injected fetch), DOM in src/ui/
  • No new runtime dependency
  • README / CHANGELOG.md ([Unreleased]) updated if behavior or the deployed surface changed — n/a, test-only, no app behaviour change
  • Reconciled affected tracked work (roadmap Roadmap to 1.0.0 #68, the issue body, ADR/CHANGELOG) if this change reshaped it

🤖 Generated with Claude Code

https://claude.ai/code/session_01GiubaoqEuBzAyo5C4P8Vqr

BorisTyshkevich and others added 2 commits July 29, 2026 16:33
…phantom class

The mobile Dashboard e2e fixture rendered a `has-variables` class on the
variable toolbar that `src/ui/dashboard.ts` never sets — the app always
builds the toolbar with just `dash-toolbar dash-toolbar-variables` and hides
it via an inline `style.display: 'none'` when there are no ordinary
variables. Drop the phantom class from the fixture and re-point the two
specs (scroll/popover-escape and desktop row-height) at the real class,
asserting the toolbar's actual `style.display` instead of a hand-written
marker. Sabotage-verified: forcing `style="display: none"` onto the fixture's
toolbar turns both re-pointed specs red; reverted after confirming.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiubaoqEuBzAyo5C4P8Vqr
…ract

The hidden branch of ui/dashboard.ts's `hasOrdinaryVariables ? undefined :
{ display: 'none' }` ternary already had a real-app unit test; the shown
branch was asserted nowhere against createApp, only against the e2e
fixture's hand-written markup. Add a dashApp/wsWith render with an ordinary
(non-time-range) variable and assert `.dash-toolbar-variables`'s inline
style.display is '' (no override). Sabotage-verified: flipping the ternary in
src/ui/dashboard.ts turns both this test and the existing hidden-toolbar test
red; reverted after confirming (checksum-verified restore).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiubaoqEuBzAyo5C4P8Vqr
@BorisTyshkevich
BorisTyshkevich merged commit 22873d8 into main Jul 29, 2026
8 checks passed
@BorisTyshkevich
BorisTyshkevich deleted the test/e2e-has-variables-473 branch August 6, 2026 15:28
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.

e2e fixture asserts a .has-variables toolbar class the app never sets

1 participant