Skip to content

Commit

Permalink
Fix failing unit tests caused by incorrect import paths in the Icon c…
Browse files Browse the repository at this point in the history
…omponent
  • Loading branch information
gziolo committed Oct 15, 2019
1 parent 9d88689 commit 59f536f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/components/src/icon-button/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe( 'IconButton', () => {

it( 'should render a Dashicon component matching the wordpress icon', () => {
const iconButton = shallow( <IconButton icon="wordpress" /> );
expect( iconButton.find( 'Dashicon' ).shallow().hasClass( 'dashicons-wordpress' ) ).toBe( true );
expect( iconButton.find( 'Icon' ).dive().shallow().hasClass( 'dashicons-wordpress' ) ).toBe( true );
} );

it( 'should render child elements when passed as children', () => {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { cloneElement, createElement, Component, isValidElement } from '@wordpre
/**
* Internal dependencies
*/
import { Dashicon, SVG } from '../';
import Dashicon from '../dashicon';
import { SVG } from '../primitives';

function Icon( { icon = null, size, ...additionalProps } ) {
let iconSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,16 @@ exports[`MoreMenu should match snapshot 1`] = `
onMouseLeave={[Function]}
type="button"
>
<Dashicon
<Icon
icon="ellipsis"
key="0,0"
>
<SVG
aria-hidden={true}
className="dashicon dashicons-ellipsis"
focusable="false"
height={20}
role="img"
viewBox="0 0 20 20"
width={20}
xmlns="http://www.w3.org/2000/svg"
<Dashicon
icon="ellipsis"
size={20}
>
<svg
aria-hidden="true"
<SVG
aria-hidden={true}
className="dashicon dashicons-ellipsis"
focusable="false"
height={20}
Expand All @@ -98,16 +92,27 @@ exports[`MoreMenu should match snapshot 1`] = `
width={20}
xmlns="http://www.w3.org/2000/svg"
>
<Path
d="M5 10c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm12-2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-7 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
<svg
aria-hidden="true"
className="dashicon dashicons-ellipsis"
focusable="false"
height={20}
role="img"
viewBox="0 0 20 20"
width={20}
xmlns="http://www.w3.org/2000/svg"
>
<path
<Path
d="M5 10c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm12-2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-7 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</Path>
</svg>
</SVG>
</Dashicon>
>
<path
d="M5 10c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm12-2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-7 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"
/>
</Path>
</svg>
</SVG>
</Dashicon>
</Icon>
</button>
</ForwardRef(Button)>
</Tooltip>
Expand Down

0 comments on commit 59f536f

Please sign in to comment.