Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Resolve #135: Added dropup on dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Olyno committed Oct 9, 2019
1 parent b9af827 commit 9160f21
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/Dropdown/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ export interface Dropdown<T> extends Bulma.Active, Bulma.Alignment, Bulma.Tag, R
isActive?: boolean;
isAlign?: 'right';
isHoverable?: boolean;
isDropup?: boolean;
}

export function Dropdown({ tag = 'div', isHoverable, ...props }: Dropdown<HTMLElement>) {
export function Dropdown({ tag = 'div', isHoverable, isDropup, ...props }: Dropdown<HTMLElement>) {
const className = classNames(
'dropdown',
{
'is-hoverable': isHoverable,
'is-up': isDropup,
...combineModifiers(props, getActiveModifiers, getAlignmentModifiers),
},
props.className,
Expand Down
7 changes: 7 additions & 0 deletions test/components/Dropdown/Dropdown.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,11 @@ describe('Dropdown', () => {
expect(component.hasClass('is-hoverable')).toBe(true);
expect(component.hasClass('is-right')).toBe(true);
});

it('should make dropdown dropup', () => {
const component = shallow(<Dropdown isDropup isAlign="right" isHoverable>My Dropdown</Dropdown>);
expect(component.hasClass('dropdown')).toBe(true);
expect(component.hasClass('is-hoverable')).toBe(true);
expect(component.hasClass('is-up')).toBe(true);
});
});

0 comments on commit 9160f21

Please sign in to comment.