Skip to content

Commit

Permalink
Tests: Update PanelColor component unit tests (#3797)
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo authored Dec 4, 2017
1 parent ff9c02a commit 9bfd837
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 34 deletions.
31 changes: 2 additions & 29 deletions components/panel/test/__snapshots__/color.js.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`PanelColor should match snapshot 1`] = `
exports[`PanelColor should match snapshot when title is provided 1`] = `
<PanelBody
title={
Array [
Expand All @@ -9,34 +9,7 @@ exports[`PanelColor should match snapshot 1`] = `
>
sample title
</span>,
<span
className="components-panel__color-area"
style={
Object {
"background": "red",
}
}
/>,
]
}
/>
`;

exports[`PanelColor should match snapshot when title is empty 1`] = `
<PanelBody
title={
Array [
<span
className="components-panel__color-title"
/>,
<span
className="components-panel__color-area"
style={
Object {
"background": "red",
}
}
/>,
undefined,
]
}
/>
Expand Down
15 changes: 10 additions & 5 deletions components/panel/test/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import { shallow } from 'enzyme';
import PanelColor from '../color';

describe( 'PanelColor', () => {
it( 'should match snapshot', () => {
const wrapper = shallow( <PanelColor colorValue="red" title="sample title" /> );
it( 'should match snapshot when title is provided', () => {
const wrapper = shallow( <PanelColor title="sample title" /> );

expect( wrapper ).toMatchSnapshot();
} );
it( 'should match snapshot when title is empty', () => {
const wrapper = shallow( <PanelColor colorValue="red" /> );
expect( wrapper ).toMatchSnapshot();

it( 'should have color when provided', () => {
const wrapper = shallow( <PanelColor colorValue="red" title="sample title" /> );

expect( wrapper.prop( 'title' ) ).toContainEqual(
<span className="components-panel__color-area" key="color" style={ { background: 'red' } } />
);
} );
} );

0 comments on commit 9bfd837

Please sign in to comment.