forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSkipLink.test.js
More file actions
30 lines (27 loc) · 849 Bytes
/
SkipLink.test.js
File metadata and controls
30 lines (27 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import React from 'react'
import { render, cleanup } from '@testing-library/react'
import { ThemeProvider, theme } from '@chakra-ui/core'
import { SkipLink } from '../SkipLink'
describe('SkipLinks', () => {
afterEach(cleanup)
it('are visible by default', () => {
const { getByText } = render(
<ThemeProvider theme={theme}>
<SkipLink to="#top">skip to top</SkipLink>
</ThemeProvider>,
)
const test = getByText(/skip to top/)
expect(test).not.toHaveStyle('z-index: -999;')
})
it('are invisible if invisible prop set', () => {
const { getByText } = render(
<ThemeProvider theme={theme}>
<SkipLink invisible to="#top">
skip to top
</SkipLink>
</ThemeProvider>,
)
const test = getByText(/skip to top/)
expect(test).toHaveStyle('z-index: -999;')
})
})