Skip to content

Commit 932d401

Browse files
Various bugfixes after 0.12 (#178)
* fix: deps in mods * Create eleven-geckos-protect.md Co-authored-by: Sergey Garin <sergey.garin@cube.dev>
1 parent 4772d55 commit 932d401

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

.changeset/eleven-geckos-protect.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cube-dev/ui-kit": patch
3+
---
4+
5+
Fixed bug in button when `isLoading` prop didn't affect on mods

src/components/actions/Button/Button.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ export const Button = forwardRef(
346346
'single-icon-only': singleIcon,
347347
...mods,
348348
}),
349-
[mods],
349+
[mods, isDisabled, isLoading, isSelected, singleIcon],
350350
);
351351

352352
return (
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { render, screen } from '../../../test';
2+
import { Button } from './Button';
3+
4+
describe('<Button />', () => {
5+
it('should add data-qa', () => {
6+
render(<Button data-qa="test">label</Button>);
7+
8+
expect(screen.getByTestId('test')).toBeInTheDocument();
9+
});
10+
11+
it('should have data-is-loading', () => {
12+
render(
13+
<Button isLoading data-qa="ApplyDbConnection">
14+
Apply
15+
</Button>,
16+
);
17+
18+
expect(screen.getByTestId('ApplyDbConnection')).toHaveAttribute(
19+
'data-is-loading',
20+
'',
21+
);
22+
});
23+
24+
it('should have data-is-loading after rerender', () => {
25+
const { rerender } = render(
26+
<Button isLoading={false} data-qa="ApplyDbConnection">
27+
Apply
28+
</Button>,
29+
);
30+
31+
rerender(
32+
<Button isLoading data-qa="ApplyDbConnection">
33+
Apply
34+
</Button>,
35+
);
36+
37+
expect(screen.getByTestId('ApplyDbConnection')).toHaveAttribute(
38+
'data-is-loading',
39+
'',
40+
);
41+
});
42+
});

0 commit comments

Comments
 (0)