mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
fix(web): prevent narrow session tooltips (#1114)
This commit is contained in:
@@ -9,6 +9,18 @@ import {
|
||||
afterEach(() => cleanup())
|
||||
|
||||
describe('HoverTooltip keyboard wiring', () => {
|
||||
it('sizes short localized tooltips to their content up to the maximum width', () => {
|
||||
render(
|
||||
<HoverTooltip id="attention-tooltip" target={<span>dot</span>}>
|
||||
有新活动
|
||||
</HoverTooltip>
|
||||
)
|
||||
|
||||
const tooltip = screen.getByRole('tooltip', { hidden: true })
|
||||
expect(tooltip.className).toContain('w-max')
|
||||
expect(tooltip.className).toContain('max-w-[14rem]')
|
||||
})
|
||||
|
||||
it('applies parent row focus-visible reveal classes', () => {
|
||||
render(
|
||||
<HoverTooltip
|
||||
|
||||
@@ -72,7 +72,7 @@ export function HoverTooltip(props: {
|
||||
id={props.id}
|
||||
className={cn(
|
||||
'pointer-events-none absolute z-30 whitespace-normal',
|
||||
spansRow ? 'max-w-none' : 'max-w-[14rem]',
|
||||
spansRow ? 'max-w-none' : 'w-max max-w-[14rem]',
|
||||
'rounded-md border border-[var(--app-border)] bg-[var(--app-secondary-bg)]',
|
||||
'px-2 py-1 text-xs leading-snug text-[var(--app-fg)] shadow-lg',
|
||||
side === 'top' ? 'bottom-full mb-1' : 'top-full mt-1',
|
||||
|
||||
Reference in New Issue
Block a user