Hide add FAB at task limit
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { act, fireEvent, render, screen } from '@testing-library/react';
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import * as api from '../../api';
|
||||
|
||||
const fixtures = vi.hoisted(() => ({
|
||||
@@ -309,4 +309,23 @@ describe('MobileEventTasksPage', () => {
|
||||
|
||||
expect((await screen.findAllByText('Auswahl löschen')).length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('hides the add FAB when the task limit is reached', async () => {
|
||||
(api.getEvent as unknown as { mockResolvedValueOnce: (value: any) => void }).mockResolvedValueOnce({
|
||||
...fixtures.event,
|
||||
limits: {
|
||||
tasks: {
|
||||
limit: 2,
|
||||
remaining: 0,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
render(<MobileEventTasksPage />);
|
||||
|
||||
expect(await screen.findByText('Photo task mode')).toBeInTheDocument();
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByLabelText('Add')).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user