generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from eea/develop
Release
- Loading branch information
Showing
6 changed files
with
239 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import React from 'react'; | ||
import renderer from 'react-test-renderer'; | ||
import View from './View'; | ||
|
||
describe('View', () => { | ||
it('should render the component', () => { | ||
const component = renderer.create(<View data={{}} />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
}); | ||
|
||
it('should render the component with prop hidden', () => { | ||
const component = renderer.create(<View data={{ hidden: true }} />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.children[0].props.className).toContain('hidden'); | ||
}); | ||
|
||
it('should render the component with prop section', () => { | ||
const component = renderer.create(<View data={{ section: true }} />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.children[0].props.className).toContain('section'); | ||
}); | ||
|
||
it('should render the component with prop fitted', () => { | ||
const component = renderer.create(<View data={{ fitted: true }} />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.children[0].props.className).toContain('fitted'); | ||
}); | ||
|
||
it('should render the component with prop text', () => { | ||
const component = renderer.create(<View data={{ text: 'test test' }} />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.children[0].props.className).toContain('horizontal'); | ||
}); | ||
|
||
it('should render the component with prop styles with theme', () => { | ||
const component = renderer.create( | ||
<View data={{ styles: { theme: 'test', inverted: true } }} />, | ||
); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.props.className).toContain('test'); | ||
expect(json.props.className).toContain('inverted'); | ||
}); | ||
|
||
it('should render the component with prop styles, with no theme', () => { | ||
const component = renderer.create( | ||
<View data={{ styles: { inverted: true } }} />, | ||
); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.children[0].props.className).toContain('inverted'); | ||
}); | ||
|
||
it('should render the component with short', () => { | ||
const component = renderer.create(<View data={{ short: true }} />); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.children[0].props.className).toContain('short'); | ||
}); | ||
|
||
it('should render the component with all props with no theme', () => { | ||
const component = renderer.create( | ||
<View | ||
data={{ | ||
hidden: true, | ||
fitted: true, | ||
text: 'test test', | ||
styles: { inverted: true }, | ||
}} | ||
/>, | ||
); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.children[0].props.className).toContain('hidden'); | ||
expect(json.children[0].props.className).toContain('fitted'); | ||
expect(json.children[0].props.className).toContain('inverted'); | ||
expect(json.children[0].props.className).toContain('horizontal'); | ||
}); | ||
|
||
it('should render the component with all props with theme', () => { | ||
const component = renderer.create( | ||
<View | ||
data={{ | ||
hidden: true, | ||
fitted: true, | ||
text: 'test test', | ||
styles: { theme: 'test', inverted: true }, | ||
}} | ||
/>, | ||
); | ||
const json = component.toJSON(); | ||
expect(json).toMatchSnapshot(); | ||
expect(json.props.className).toContain('hidden'); | ||
expect(json.props.className).toContain('fitted'); | ||
expect(json.props.className).toContain('inverted'); | ||
expect(json.props.className).toContain('horizontal'); | ||
}); | ||
}); |
119 changes: 119 additions & 0 deletions
119
src/components/Divider/__snapshots__/View.test.jsx.snap
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`View should render the component 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui divider" | ||
> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with all props with no theme 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui fitted hidden horizontal inverted divider" | ||
> | ||
<div> | ||
test test | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with all props with theme 1`] = ` | ||
<div | ||
className="ui fitted hidden horizontal inverted divider test" | ||
> | ||
<div> | ||
test test | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with prop fitted 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui fitted divider" | ||
> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with prop hidden 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui hidden divider" | ||
> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with prop section 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui section divider" | ||
> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with prop styles with theme 1`] = ` | ||
<div | ||
className="ui inverted divider test" | ||
> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with prop styles, with no theme 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui inverted divider" | ||
> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with prop text 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui horizontal divider" | ||
> | ||
<div> | ||
test test | ||
</div> | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`View should render the component with short 1`] = ` | ||
<div | ||
className="styled-dividerBlock" | ||
> | ||
<div | ||
className="ui divider short" | ||
> | ||
</div> | ||
</div> | ||
`; |