File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,18 @@ import {
99afterEach ( ( ) => cleanup ( ) )
1010
1111describe ( 'HoverTooltip keyboard wiring' , ( ) => {
12+ it ( 'sizes short localized tooltips to their content up to the maximum width' , ( ) => {
13+ render (
14+ < HoverTooltip id = "attention-tooltip" target = { < span > dot</ span > } >
15+ 有新活动
16+ </ HoverTooltip >
17+ )
18+
19+ const tooltip = screen . getByRole ( 'tooltip' , { hidden : true } )
20+ expect ( tooltip . className ) . toContain ( 'w-max' )
21+ expect ( tooltip . className ) . toContain ( 'max-w-[14rem]' )
22+ } )
23+
1224 it ( 'applies parent row focus-visible reveal classes' , ( ) => {
1325 render (
1426 < HoverTooltip
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ export function HoverTooltip(props: {
7272 id = { props . id }
7373 className = { cn (
7474 'pointer-events-none absolute z-30 whitespace-normal' ,
75- spansRow ? 'max-w-none' : 'max-w-[14rem]' ,
75+ spansRow ? 'max-w-none' : 'w-max max-w-[14rem]' ,
7676 'rounded-md border border-[var(--app-border)] bg-[var(--app-secondary-bg)]' ,
7777 'px-2 py-1 text-xs leading-snug text-[var(--app-fg)] shadow-lg' ,
7878 side === 'top' ? 'bottom-full mb-1' : 'top-full mt-1' ,
You can’t perform that action at this time.
0 commit comments