Skip to content

Commit

Permalink
update Title tests with new modifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcfaul committed Dec 14, 2023
1 parent 33d7f7c commit 523c660
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions packages/react-core/src/components/Title/__tests__/Title.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ test(`Renders with the ${styles.title}`, () => {
expect(screen.getByRole('heading')).toHaveClass(styles.title);
});

test(`Renders with only the class ${styles.title} and the heading level modifier class ${styles.modifiers['2xl']} by default`, () => {
test(`Renders with only the class ${styles.title} and the heading level modifier class ${styles.modifiers.h1} by default`, () => {
render(<Title headingLevel="h1">Test</Title>);
expect(screen.getByRole('heading')).toHaveClass(`${styles.title} ${styles.modifiers['2xl']}`, { exact: true });
expect(screen.getByRole('heading')).toHaveClass(`${styles.title} ${styles.modifiers.h1}`, { exact: true });
});

test('Renders with custom class name when className prop is passed', () => {
Expand All @@ -36,34 +36,34 @@ test('Renders with custom class name when className prop is passed', () => {
expect(screen.getByRole('heading')).toHaveClass('test-class');
});

test('Renders with class name pf-m-2xl by default when "h1" is passed as heading level', () => {
test('Renders with class name pf-m-h1 by default when "h1" is passed as heading level', () => {
render(<Title headingLevel="h1">Test</Title>);
expect(screen.getByRole('heading')).toHaveClass('pf-m-2xl');
expect(screen.getByRole('heading')).toHaveClass('pf-m-h1');
});

test('Renders with class name pf-m-xl by default when "h2" is passed as heading level', () => {
test('Renders with class name pf-m-h2 by default when "h2" is passed as heading level', () => {
render(<Title headingLevel="h2">Test</Title>);
expect(screen.getByRole('heading')).toHaveClass('pf-m-xl');
expect(screen.getByRole('heading')).toHaveClass('pf-m-h2');
});

test('Renders with class name pf-m-lg by default when "h3" is passed as heading level', () => {
test('Renders with class name pf-m-h3 by default when "h3" is passed as heading level', () => {
render(<Title headingLevel="h3">Test</Title>);
expect(screen.getByRole('heading')).toHaveClass('pf-m-lg');
expect(screen.getByRole('heading')).toHaveClass('pf-m-h3');
});

test('Renders with class name pf-m-md by default when "h4" is passed as heading level', () => {
test('Renders with class name pf-m-h4 by default when "h4" is passed as heading level', () => {
render(<Title headingLevel="h4">Test</Title>);
expect(screen.getByRole('heading')).toHaveClass('pf-m-md');
expect(screen.getByRole('heading')).toHaveClass('pf-m-h4');
});

test('Renders with class name pf-m-md by default when "h5" is passed as heading level', () => {
test('Renders with class name pf-m-h5 by default when "h5" is passed as heading level', () => {
render(<Title headingLevel="h5">Test</Title>);
expect(screen.getByRole('heading')).toHaveClass('pf-m-md');
expect(screen.getByRole('heading')).toHaveClass('pf-m-h5');
});

test('Renders with class name pf-m-md by default when "h6" is passed as heading level', () => {
test('Renders with class name pf-m-h6 by default when "h6" is passed as heading level', () => {
render(<Title headingLevel="h6">Test</Title>);
expect(screen.getByRole('heading')).toHaveClass('pf-m-md');
expect(screen.getByRole('heading')).toHaveClass('pf-m-h6');
});

test('Renders with class name pf-m-md when "md" is passed as title size', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Matches the snapshot 1`] = `
<DocumentFragment>
<h1
class="pf-v5-c-title pf-m-2xl"
class="pf-v5-c-title pf-m-h1"
data-ouia-component-id="ouia-id"
data-ouia-component-type="PF5/Title"
data-ouia-safe="true"
Expand Down

0 comments on commit 523c660

Please sign in to comment.