import { Typography } from '../common'; import { render, screen } from '../test-utils'; import Display from '.'; describe('Display', () => { it('testing default state', () => { render(Test); const copy = screen.getByText('Test'); expect(copy.tagName).toBe('H1'); expect(copy).toHaveClass( 'np-display', `np-text-${Typography.DISPLAY_LARGE}`, `wds-text-${Typography.DISPLAY_LARGE}`, ); }); it('renders both typography classes for the given type', () => { render(Test); expect(screen.getByText('Test')).toHaveClass( `np-text-${Typography.DISPLAY_NUMBER_MEDIUM}`, `wds-text-${Typography.DISPLAY_NUMBER_MEDIUM}`, ); }); it('renders only the legacy class for display-extra-large, which has no locale-aware style', () => { render(Test); const copy = screen.getByText('Test'); expect(copy).toHaveClass(`np-text-${Typography.DISPLAY_EXTRA_LARGE}`); expect(copy).not.toHaveClass(`wds-text-${Typography.DISPLAY_EXTRA_LARGE}`); }); it('enforces tag via `as` prop and merges `className`', () => { render( Test , ); const copy = screen.getByText('Test'); expect(copy.tagName).toBe('H3'); expect(copy).toHaveClass('custom', `wds-text-${Typography.DISPLAY_LARGE}`); }); });