-
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.
Components: Stop rendering MenuItemsGroup when no menu items provided
- Loading branch information
Showing
3 changed files
with
66 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
24 changes: 24 additions & 0 deletions
24
components/menu-items/test/__snapshots__/menu-items-group.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,24 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`MenuItemsGroup should match snapshot 1`] = ` | ||
<div | ||
className="components-menu-items-group" | ||
> | ||
<div | ||
className="components-menu-items-group__label" | ||
id="components-menu-items-group-label-1" | ||
> | ||
My group | ||
</div> | ||
<NavigableMenu | ||
aria-labelledby="components-menu-items-group-label-1" | ||
orientation="vertical" | ||
> | ||
<p | ||
key=".0" | ||
> | ||
My item | ||
</p> | ||
</NavigableMenu> | ||
</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,30 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { shallow } from 'enzyme'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { MenuItemsGroup } from '../menu-items-group'; | ||
|
||
describe( 'MenuItemsGroup', () => { | ||
test( 'should render null when no children provided', () => { | ||
const wrapper = shallow( <MenuItemsGroup /> ); | ||
|
||
expect( wrapper.html() ).toBe( null ); | ||
} ); | ||
|
||
test( 'should match snapshot', () => { | ||
const wrapper = shallow( | ||
<MenuItemsGroup | ||
label="My group" | ||
instanceId="1" | ||
> | ||
<p>My item</p> | ||
</MenuItemsGroup> | ||
); | ||
|
||
expect( wrapper ).toMatchSnapshot(); | ||
} ); | ||
} ); |