Skip to content

Commit d4a32f1

Browse files
committed
feat(DesignSystem): add disabled property to Dropdown
1 parent 0f2a626 commit d4a32f1

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

packages/design-system/src/lib/components/dropdown-button/DropdownButton.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface DropdownButtonProps {
1515
withSpacing?: boolean
1616
asButtonGroup?: boolean
1717
onSelect?: (eventKey: string | null) => void
18+
disabled?: boolean
1819
children: ReactNode
1920
}
2021

@@ -26,6 +27,7 @@ export function DropdownButton({
2627
withSpacing,
2728
asButtonGroup,
2829
onSelect,
30+
disabled,
2931
children
3032
}: DropdownButtonProps) {
3133
return (
@@ -40,6 +42,7 @@ export function DropdownButton({
4042
}
4143
variant={variant}
4244
as={asButtonGroup ? ButtonGroup : undefined}
45+
disabled={disabled}
4346
onSelect={onSelect}>
4447
{children}
4548
</DropdownButtonBS>

packages/design-system/tests/component/dropdown-button/DropdownButton.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,14 @@ describe('DropdownButton', () => {
111111

112112
cy.findByRole('separator').should('exist')
113113
})
114+
115+
it('renders disabled', () => {
116+
cy.mount(
117+
<DropdownButton id="dropdown-button" title={titleText} disabled>
118+
<DropdownItem eventKey="1">Item 1</DropdownItem>
119+
<DropdownItem eventKey="2">Item 2</DropdownItem>
120+
</DropdownButton>
121+
)
122+
cy.findByText(titleText).should('be.disabled')
123+
})
114124
})

0 commit comments

Comments
 (0)