Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/buttons/src/views/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const StyledButton = styled.button.attrs({
}) =>
classNames(ButtonStyles['c-btn'], {
// Danger styling
[ButtonStyles['c-btn--danger']]: danger,
[ButtonStyles['c-btn--danger']]: !disabled && danger,

// Styles
[ButtonStyles['c-btn--primary']]: primary,
Expand Down
6 changes: 6 additions & 0 deletions packages/buttons/src/views/Button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ describe('Button', () => {
expect(wrapper).toMatchSnapshot();
});

it('renders correct combination of danger and disabled styling if provided', () => {
const wrapper = mount(<Button danger disabled />);

expect(wrapper).toMatchSnapshot();
});

it('renders stretched styling if provided', () => {
const wrapper = mount(<Button stretched />);

Expand Down
31 changes: 31 additions & 0 deletions packages/buttons/src/views/__snapshots__/Button.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,37 @@ exports[`Button Types renders primary styling if provided 1`] = `
</Button>
`;

exports[`Button renders correct combination of danger and disabled styling if provided 1`] = `
<Button
danger={true}
disabled={true}
>
<KeyboardFocusContainer>
<Button__StyledButton
danger={true}
disabled={true}
focused={false}
onBlur={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
tabIndex={0}
>
<button
className="c-btn is-disabled "
data-garden-id="buttons.button"
data-garden-version="version"
disabled={true}
onBlur={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
tabIndex={0}
type="button"
/>
</Button__StyledButton>
</KeyboardFocusContainer>
</Button>
`;

exports[`Button renders danger styling if provided 1`] = `
<Button
danger={true}
Expand Down