|
| 1 | +import {render} from '@testing-library/react' |
| 2 | +import React from 'react' |
| 3 | +import {ThemeProvider} from '..' |
| 4 | +import {PageLayout} from './PageLayout' |
| 5 | + |
| 6 | +describe('PageLayout', () => { |
| 7 | + it('renders default layout', () => { |
| 8 | + const {container} = render( |
| 9 | + <ThemeProvider> |
| 10 | + <PageLayout> |
| 11 | + <PageLayout.Header>Header</PageLayout.Header> |
| 12 | + <PageLayout.Content>Content</PageLayout.Content> |
| 13 | + <PageLayout.Pane>Pane</PageLayout.Pane> |
| 14 | + <PageLayout.Footer>Footer</PageLayout.Footer> |
| 15 | + </PageLayout> |
| 16 | + </ThemeProvider> |
| 17 | + ) |
| 18 | + expect(container).toMatchSnapshot() |
| 19 | + }) |
| 20 | + |
| 21 | + it('renders condensed layout', () => { |
| 22 | + const {container} = render( |
| 23 | + <ThemeProvider> |
| 24 | + <PageLayout padding="condensed" rowGap="condensed" columnGap="condensed"> |
| 25 | + <PageLayout.Header>Header</PageLayout.Header> |
| 26 | + <PageLayout.Content>Content</PageLayout.Content> |
| 27 | + <PageLayout.Pane>Pane</PageLayout.Pane> |
| 28 | + <PageLayout.Footer>Footer</PageLayout.Footer> |
| 29 | + </PageLayout> |
| 30 | + </ThemeProvider> |
| 31 | + ) |
| 32 | + expect(container).toMatchSnapshot() |
| 33 | + }) |
| 34 | + |
| 35 | + it('renders with dividers', () => { |
| 36 | + const {container} = render( |
| 37 | + <ThemeProvider> |
| 38 | + <PageLayout> |
| 39 | + <PageLayout.Header divider="line" dividerWhenNarrow="filled"> |
| 40 | + Header |
| 41 | + </PageLayout.Header> |
| 42 | + <PageLayout.Content>Content</PageLayout.Content> |
| 43 | + <PageLayout.Pane position="start" divider="line" dividerWhenNarrow="filled"> |
| 44 | + Pane |
| 45 | + </PageLayout.Pane> |
| 46 | + <PageLayout.Footer dividerWhenNarrow="line">Footer</PageLayout.Footer> |
| 47 | + </PageLayout> |
| 48 | + </ThemeProvider> |
| 49 | + ) |
| 50 | + expect(container).toMatchSnapshot() |
| 51 | + }) |
| 52 | + |
| 53 | + it('renders pane in different position when narrow', () => { |
| 54 | + const {container} = render( |
| 55 | + <ThemeProvider> |
| 56 | + <PageLayout> |
| 57 | + <PageLayout.Header>Header</PageLayout.Header> |
| 58 | + <PageLayout.Content>Content</PageLayout.Content> |
| 59 | + <PageLayout.Pane positionWhenNarrow="start">Pane</PageLayout.Pane> |
| 60 | + <PageLayout.Footer>Footer</PageLayout.Footer> |
| 61 | + </PageLayout> |
| 62 | + </ThemeProvider> |
| 63 | + ) |
| 64 | + expect(container).toMatchSnapshot() |
| 65 | + }) |
| 66 | +}) |
0 commit comments