Skip to content

Commit

Permalink
feat(DropdownMenu): added dropdown menu component, created bento menu…
Browse files Browse the repository at this point in the history
… and update user-profile
  • Loading branch information
JsGarneau committed Sep 21, 2021
1 parent 6c8c20a commit 352634d
Show file tree
Hide file tree
Showing 34 changed files with 3,493 additions and 328 deletions.
2 changes: 1 addition & 1 deletion packages/kronos-crm-icons/src/eye-slave.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/kronos-crm-icons/src/recur-slave.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/kronos-crm-icons/src/sort-alpha-desc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/kronos-fna-icons/src/print.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/kronos-fna-icons/src/synchro.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/react/src/components/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Icon } from '../icon/icon';

export type AvatarSize = 'xsmall' | 'small' | 'medium' | 'large'

interface AvatarProps {
export interface AvatarProps {
className?: string;
username?: string;
bgColor?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import React, { ReactElement } from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { getByTestId } from '../../test-utils/enzyme-selectors';
import { mountWithTheme, mountWithProviders, renderWithTheme } from '../../test-utils/renderer';
import { BentoMenuButton } from './bento-menu-button';
import { ExternalItemProps, NavItemProps } from '../dropdown-menu/list-items';

jest.mock('../../utils/uuid');

function setup(children: ReactElement): ReactElement {
return (
<Router>
{children}
</Router>
);
}

const products = [
{
id: 'optiona',
label: 'Option A',
value: 'optionA',
to: '/testa',
},
{
id: 'optionB',
label: 'Option B',
value: 'optionB',
to: '/testb',
},
{
id: 'optionC',
label: 'Option C',
value: 'optionC',
to: '/testc',
},
{
id: 'optionD',
label: 'Option D',
value: 'optionD',
to: '/testd',
},
] as NavItemProps[];

const externals = [
{
id: 'optionA',
label: 'Option A',
href: '/testa',
},
] as ExternalItemProps[];

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 = mountWithTheme(setup(
<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 = renderWithTheme(setup(
<BentoMenuButton productLinks={products} externalLinks={externals} />,
));

expect(tree).toMatchSnapshot();
});
});
Loading

0 comments on commit 352634d

Please sign in to comment.