@@ -3,6 +3,7 @@ import { type ReactNode, useRef, useState } from "react";
33import { expect , it , vi } from "vite-plus/test" ;
44import { page , userEvent } from "vite-plus/test/browser" ;
55
6+ import "../../index.css" ;
67import { render } from "../../../test/render" ;
78import { ComposerHandleContext , type ComposerHandleRef } from "../../composerHandleContext" ;
89import { Menu , MenuPopup , MenuRadioGroup , MenuRadioItem , MenuTrigger } from "../ui/menu" ;
@@ -87,6 +88,26 @@ it("marks the current mode as checked and closes on Escape", async () => {
8788 await expect . element ( screen . getByRole ( "button" , { name : "Effort" } ) ) . toHaveFocus ( ) ;
8889} ) ;
8990
91+ it ( "keeps the space between permission options clickable" , async ( ) => {
92+ await using screen = await render ( < EffortMenu /> , { router : false } ) ;
93+ await userEvent . click ( screen . getByRole ( "button" , { name : "Effort" } ) ) ;
94+ const items = options . map ( ( option ) =>
95+ page . getByRole ( "menuitemradio" , { name : option . label } ) . element ( ) ,
96+ ) ;
97+
98+ for ( let i = 0 ; i < items . length - 1 ; i ++ ) {
99+ const left = items [ i ] ! ;
100+ const right = items [ i + 1 ] ! ;
101+ const leftRect = left . getBoundingClientRect ( ) ;
102+ const rightRect = right . getBoundingClientRect ( ) ;
103+ expect ( rightRect . left - leftRect . right ) . toBeLessThanOrEqual ( 0 ) ;
104+ for ( const y of [ leftRect . top + 1 , leftRect . top + leftRect . height / 2 ] ) {
105+ expect ( left . contains ( document . elementFromPoint ( leftRect . right - 1.5 , y ) ) ) . toBe ( true ) ;
106+ expect ( right . contains ( document . elementFromPoint ( rightRect . left + 1.5 , y ) ) ) . toBe ( true ) ;
107+ }
108+ }
109+ } ) ;
110+
90111// The real composer menu focus rule (useComposerMenuProps), with a stub composer handle.
91112function withComposer ( children : ReactNode ) {
92113 const handle = { focusAtEnd : vi . fn ( ) } ;
0 commit comments