-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nick Lemmon
committed
Mar 22, 2020
1 parent
ff17374
commit d293b75
Showing
2 changed files
with
17 additions
and
16 deletions.
There are no files selected for viewing
24 changes: 17 additions & 7 deletions
24
packages/matchbox/src/components/ScreenReaderOnly/tests/ScreenReaderOnly.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,27 @@ | ||
import React from 'react'; | ||
import 'jest-styled-components'; | ||
import { mount } from 'enzyme'; | ||
import ScreenReaderOnly from '../ScreenReaderOnly'; | ||
import { shallow } from 'enzyme'; | ||
|
||
describe('ScreenReaderOnly', () => { | ||
it('Renders according to the snapshot', () => { | ||
const wrapper = shallow(<ScreenReaderOnly>I am screen reader only content.</ScreenReaderOnly>); | ||
it('renders with passed in children', () => { | ||
const wrapper = mount(<ScreenReaderOnly>Children!</ScreenReaderOnly>); | ||
|
||
expect(wrapper).toMatchSnapshot(); | ||
expect(wrapper).toHaveText('Children!'); | ||
}); | ||
|
||
it('Renders the component using as a `<span></span>` to ensure it can be used in all situations (i.e., within other inline elements)', () => { | ||
const wrapper = shallow(<ScreenReaderOnly>I will surely render as a span!</ScreenReaderOnly>); | ||
it('renders with necessary style rules', () => { | ||
const wrapper = global.mountStyled(<ScreenReaderOnly>Children!</ScreenReaderOnly>); | ||
|
||
expect(wrapper.find('span')).toHaveLength(1); | ||
expect(wrapper).toHaveStyleRule('border', '0 !important'); | ||
expect(wrapper).toHaveStyleRule('clip', 'rect(1px,1px,1px,1px) !important'); | ||
expect(wrapper).toHaveStyleRule('clip-path', 'inset(50%) !important'); | ||
expect(wrapper).toHaveStyleRule('height', '1px !important'); | ||
expect(wrapper).toHaveStyleRule('margin', '-1px !important'); | ||
expect(wrapper).toHaveStyleRule('overflow', 'hidden !important'); | ||
expect(wrapper).toHaveStyleRule('padding', '0 !important'); | ||
expect(wrapper).toHaveStyleRule('position', 'absolute !important'); | ||
expect(wrapper).toHaveStyleRule('width', '1px !important'); | ||
expect(wrapper).toHaveStyleRule('word-wrap', 'normal !important'); | ||
}); | ||
}); |
9 changes: 0 additions & 9 deletions
9
...atchbox/src/components/ScreenReaderOnly/tests/__snapshots__/ScreenReaderOnly.test.js.snap
This file was deleted.
Oops, something went wrong.