-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DropdownMenu): added dropdown menu component, created bento menu…
… and update user-profile
- Loading branch information
Showing
35 changed files
with
3,527 additions
and
318 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
67 changes: 67 additions & 0 deletions
67
packages/react/src/components/bento-menu-button/bento-menu-button.test.tsx
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,67 @@ | ||
import React from 'react'; | ||
import { getByTestId } from '../../test-utils/enzyme-selectors'; | ||
import { mountWithProviders, renderWithProviders } from '../../test-utils/renderer'; | ||
import { BentoMenuButton } from './bento-menu-button'; | ||
import { ExternalItemProps, NavItemProps } from '../dropdown-menu/list-items'; | ||
|
||
jest.mock('../../utils/uuid'); | ||
|
||
const products: NavItemProps[] = [ | ||
{ | ||
label: 'Option A', | ||
value: 'optionA', | ||
href: '/testa', | ||
}, | ||
{ | ||
label: 'Option B', | ||
value: 'optionB', | ||
href: '/testb', | ||
}, | ||
{ | ||
label: 'Option C', | ||
value: 'optionC', | ||
href: '/testc', | ||
}, | ||
{ | ||
label: 'Option D', | ||
value: 'optionD', | ||
href: '/testd', | ||
}, | ||
]; | ||
|
||
const externals: ExternalItemProps[] = [ | ||
{ | ||
label: 'Option A', | ||
href: '/testa', | ||
}, | ||
]; | ||
|
||
describe('BentoMenuButton', () => { | ||
test('Opens bento-menu when menu-button is clicked', () => { | ||
const wrapper = mountWithProviders( | ||
<BentoMenuButton productLinks={products} externalLinks={externals} />, | ||
); | ||
|
||
getByTestId(wrapper, 'menu-button').simulate('click'); | ||
|
||
expect(getByTestId(wrapper, 'menu-dropdownMenu').prop('hidden')).toBe(false); | ||
}); | ||
|
||
test('Should close bento-menu when escape key is pressed in nav-menu', () => { | ||
const wrapper = mountWithProviders( | ||
<BentoMenuButton productLinks={products} externalLinks={externals} />, | ||
); | ||
|
||
getByTestId(wrapper, 'listitem-optionA').simulate('keydown', { key: 'Escape' }); | ||
|
||
expect(getByTestId(wrapper, 'menu-dropdownMenu').prop('hidden')).toBe(true); | ||
}); | ||
|
||
test('Matches Snapshot', () => { | ||
const tree = renderWithProviders( | ||
<BentoMenuButton productLinks={products} externalLinks={externals} />, | ||
); | ||
|
||
expect(tree).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.