Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make save button disabled after save in Team modal #1358

Merged
merged 12 commits into from
Oct 20, 2024
Prev Previous commit
Next Next commit
fix TeamModal tests
  • Loading branch information
sashapanasiuk5 committed Oct 17, 2024
commit 86cc12ae44d1e364d28eb187e5dee0fa0474e9f1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export default function overrideMatchMedia() {
overrideMatchMedia();

global.URL.createObjectURL = jest.fn(() => 'test.jpg');
global.URL.canParse = jest.fn(() => true);

const store = {
fetchTeamAll: jest.fn(),
Expand Down Expand Up @@ -242,7 +241,7 @@ describe('TeamModal', () => {
});
}, 20000);

it('fails if image is not uploaded yet', async () => {
it('save button is diabled when all fields aren`t filled', async () => {
act(() => {
render(<TeamModal open={true} setIsModalOpen={() => { }} />);
});
Expand All @@ -257,19 +256,10 @@ describe('TeamModal', () => {
userEvent.click(checkbox);
userEvent.type(nameInput, 'Test Name');
userEvent.type(descriptionInput, 'Test Description');
userEvent.upload(photoInput, new File(['(⌐□_□)'], 'test.jpg', { type: 'image/jpeg' }));
});

await waitFor(() => {
expect(createButton).not.toBeDisabled();
});

act(() => {
userEvent.click(createButton);
});

await waitFor(() => {
expect(message.error).toHaveBeenCalled();
expect(createButton).toBeDisabled();
});
}, 20000);

Expand Down