Skip to content

fix(selector): scope empty-state test query to the listbox - #4089

Merged
cixzhang merged 1 commit into
mainfrom
fix/selector-empty-state-test-query
Jul 19, 2026
Merged

cixzhang merged 1 commit into
mainfrom
fix/selector-empty-state-test-query

Conversation

@cixzhang

Copy link
Copy Markdown
Contributor

What

Fixes the failing test job on main: Selector.test.tsx > hasSearch > shows empty state when no options match.

The test asserted with an unscoped getByText('No results found'). After the search-announcement feature added a polite live region that announces the same string when nothing matches, that query now resolves two elements — the visible listbox empty state and the a11y live region — so it throws Found multiple elements with the text: No results found.

Fix

Scope the assertion to the role="listbox" element with within(...), so it targets the visible empty state only. The live-region announcement is already covered separately by the announces "No results found" when nothing matches test.

Test-only change; no runtime/behavior change, no changeset.

Verification

Selector.test.tsx — all 50 tests pass locally.

The 'shows empty state when no options match' test used an unscoped
getByText('No results found'), which now matches two nodes: the visible
listbox empty state and the polite live region that announces the same
string. Scope the assertion to the listbox so it targets the visible
empty state only.
@vercel

vercel Bot commented Jul 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 19, 2026 8:53pm

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 19, 2026
@cixzhang
cixzhang enabled auto-merge (squash) July 19, 2026 20:51
@cixzhang
cixzhang merged commit e8d4c3f into main Jul 19, 2026
20 checks passed
github-actions Bot added a commit that referenced this pull request Jul 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

Modified Components

Selector · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 1269 -
Complexity N/A Very High (101) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

This branch was successfully deployed

1 active deployment
Preview — 6a275446 Deployed Jul 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants