-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 #3780 from hideokamoto/add/test/warning
Make component unit test for editor/components/warning/index.js
- Loading branch information
Showing
2 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
editor/components/warning/test/__snapshots__/index.js.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,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Warning should match snapshot 1`] = ` | ||
<div | ||
className="editor-warning" | ||
> | ||
<Dashicon | ||
icon="warning" | ||
/> | ||
error | ||
</div> | ||
`; |
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,24 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { shallow } from 'enzyme'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Warning from '../index'; | ||
|
||
describe( 'Warning', () => { | ||
it( 'should match snapshot', () => { | ||
const wrapper = shallow( <Warning>error</Warning> ); | ||
expect( wrapper ).toMatchSnapshot(); | ||
} ); | ||
it( 'should has valid class', () => { | ||
const wrapper = shallow( <Warning /> ); | ||
expect( wrapper.hasClass( 'editor-warning' ) ).toBe( true ); | ||
} ); | ||
it( 'should show child error message element', () => { | ||
const wrapper = shallow( <Warning><p>message</p></Warning> ); | ||
expect( wrapper.find( 'p' ).text() ).toBe( 'message' ); | ||
} ); | ||
} ); |