Skip to content

Commit

Permalink
feat: Add NavMenu component
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime-gendron committed Dec 14, 2020
1 parent 045605f commit 35f69c7
Show file tree
Hide file tree
Showing 17 changed files with 3,676 additions and 1,143 deletions.
2,296 changes: 1,469 additions & 827 deletions packages/react/src/components/datepicker/datepicker.test.tsx.snap

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions packages/react/src/components/listbox/listbox.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,43 @@ describe('Listbox', () => {
expect(getByTestId(wrapper, 'listitem-optionD').prop('selected')).toBe(false);
});

test('Calls listbox-item onSelect callback when item is clicked', () => {
const callback = jest.fn();
const wrapper = shallowWithTheme(
<Listbox
options={[
{
label: 'Option Test',
value: 'optionTest',
onSelect: callback,
},
]}
/>);

getByTestId(wrapper, 'listitem-optionTest').simulate('click');

expect(callback).toHaveBeenCalledTimes(1);
});

test('Calls listbox-item onSelect callback when Enter key is pressed', () => {
const callback = jest.fn();
const wrapper = mountWithTheme(
<Listbox
options={[
{
label: 'Option Test',
value: 'optionTest',
onSelect: callback,
},
]}
/>);

wrapper.setProps({ focusedValue: 'optionTest' }).update();
getByTestId(wrapper, 'listbox-list').simulate('keydown', { key: 'Enter' });

expect(callback).toHaveBeenCalledTimes(1);
});

test('Should have the check indicator if selected', () => {
const wrapper = shallowWithTheme(<Listbox options={options} checkIndicator/>);

Expand Down
Loading

0 comments on commit 35f69c7

Please sign in to comment.