test: add regression for global aria-posinset across sections (#10554)
* test: add regression for global aria-posinset across sections
Locks in that aria-posinset is global (1..4) across sections in a
virtualized menu and matches aria-setsize, instead of restarting per
group. Passes against current main; guards the behavior from the
discussion in #9556.
* fix lint
* test: render real section structure in posinset regression
The previous helper flattened sections into plain items, so the DOM never
contained the sectioned menu structure the test claims to cover. Render
each section as a labelled group (role=presentation wrapper + role=group
with aria-labelledby heading), mirroring the real sectioned menu, and
assert the groups are present before checking the global posinset values.
* test: use useMenuSection hook in posinset regression
Render each section through the real useMenuSection hook instead of
hand-rolling the group structure, so any future logic added to the hook
(per-section count restart, references) is exercised by this test.
* test: use section title prop for heading in posinset regression
Use node.props.title for the section heading (matching how Section renders
it) and drop the redundant aria-label - with a heading present, useMenuSection
labels the group via aria-labelledby.
* test: cover aria-label fallback for unheaded sections
useMenuSection labels a section group via aria-labelledby when a heading is
present, and falls back to aria-label when the section has no heading. The
new test locks that fallback branch so the accessible name contract of
sectioned menus stays covered.
* test: render heading span via node.rendered (fiel a MenuSection real)
snowystinger senalo en 3919829010 que el span del heading debe seguir
renderizando node.rendered, no node.props.title - matching how the real
MenuSection component in @adobe/react-spectrum does it. The hook already
uses node.rendered for the heading prop, this restores the same source
for the visible span.
Also explored migrating the test to react-aria-components level with a
real Virtualizer (per snowystinger's suggestion in 5096476622) - found
that the Virtualizer path exposes different posinset behavior (resets
per section, presumably a separate issue from the original #10487 hook
contract this PR locks in). Keeping the test at the hook level where
the original contract was verified.
---------
Co-authored-by: Yihui Liao <44729383+yihuiliao@users.noreply.github.com>
Co-authored-by: gonzoblasco <15630819+gonzoblasco@users.noreply.github.com>