Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/__testing__/theme.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
SistentDefaultPrimitivePaletteLight
} from '../theme';
import { MuiButton } from '../theme/components/button.modifier';
import { MuiTooltip } from '../theme/components/tooltip.modifier';

const LIGHT_INK = SistentDefaultPrimitivePaletteLight.primaryInverted; // charcoal[100] ≈ near-white
const DARK_INK = SistentDefaultPrimitivePaletteLight.foreground; // charcoal[10] ≈ near-black
Expand Down Expand Up @@ -161,3 +162,23 @@ describe('MuiOutlinedInput line-height', () => {
);
});
});

describe('MuiTooltip typography', () => {
it.each(['light', 'dark'] as const)('uses the typography scale in %s mode', (mode) => {
const theme = createCustomTheme(mode);

const tooltip = MuiTooltip.styleOverrides?.tooltip as (props: {
theme: typeof theme;
}) => Record<string, unknown>;

const styles = tooltip({ theme });

expect(styles.fontSize).toBe(theme.typography.textB3Regular.fontSize);

expect(styles.fontSize).toBe('0.875rem');

expect(styles.padding).toBe(`${theme.spacing(1)} ${theme.spacing(1.5)}`);

expect(styles.boxShadow).toBeDefined();
});
});
4 changes: 3 additions & 1 deletion src/theme/components/tooltip.modifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export const MuiTooltip: Components<Theme>['MuiTooltip'] = {
})();

return {
boxShadow: shadow
boxShadow: shadow,
fontSize: theme.typography.textB3Regular.fontSize,
padding: `${theme.spacing(1)} ${theme.spacing(1.5)}`
} as const;
},

Expand Down
Loading