Skip to content

Commit 9c65803

Browse files
committed
Add unit test
1 parent 1c5281e commit 9c65803

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/ra-ui-materialui/src/button/SaveButton.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { AdminContext } from '../AdminContext';
2323
import {
2424
AlwaysEnable,
2525
Basic,
26+
Dirty,
2627
ComplexForm,
2728
EnabledWhenFormIsPrefilled,
2829
} from './SaveButton.stories';
@@ -69,6 +70,15 @@ describe('<SaveButton />', () => {
6970
);
7071
});
7172

73+
it('should render an enabled button when the form is dirty', async () => {
74+
render(<Dirty />);
75+
await waitFor(() =>
76+
expect(screen.getByLabelText('ra.action.save')['disabled']).toEqual(
77+
false
78+
)
79+
);
80+
});
81+
7282
it('should render as submit type by default', async () => {
7383
render(<Basic />);
7484
await waitFor(() =>

0 commit comments

Comments
 (0)