Skip to content

Commit c9446c8

Browse files
Fix tests by using actual text
1 parent d79cf25 commit c9446c8

5 files changed

Lines changed: 9 additions & 9 deletions

File tree

‎src/components/copy-button/copy-button.test.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ describe('CopyButton', () => {
2121
await userEvent.click(screen.getByTestId('copy-button'));
2222

2323
await waitFor(() => {
24-
expect(screen.getByRole('dialog', { hidden: true })).toBeInTheDocument();
24+
expect(screen.getByText('Copied!')).toBeInTheDocument();
2525
});
2626

2727
await waitFor(() => {
28-
expect(screen.queryByRole('dialog', { hidden: true })).not.toBeInTheDocument();
28+
expect(screen.queryByText('Copied!')).not.toBeInTheDocument();
2929
});
3030
});
3131
});
3232

33-
describe('all props', () => {
33+
describe('all props',() => {
3434
const mockOnCopy = jest.fn();
3535
const props = {
3636
text: 'more copiable text',
@@ -59,11 +59,11 @@ describe('CopyButton', () => {
5959
await userEvent.click(screen.getByTestId('copy-button'));
6060

6161
await waitFor(() => {
62-
expect(screen.getByRole('dialog', { hidden: true })).toBeInTheDocument();
62+
expect(screen.getByText('Copied!')).toBeInTheDocument();
6363
});
6464

6565
await waitFor(() => {
66-
expect(screen.queryByRole('dialog', { hidden: true })).not.toBeInTheDocument();
66+
expect(screen.queryByText('Copied!')).not.toBeInTheDocument();
6767
});
6868
});
6969

‎src/components/minimum-duration-loader/minimum-duration-loader.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function MinimumDurationLoader({
2323

2424
// If `isLoaded` is immediately true, load children right away.
2525
const [ wasLoaded ] = useState(isLoaded);
26-
const prevIsLoaded = usePrevious(isLoaded);
26+
const prevIsLoaded: boolean = usePrevious(isLoaded);
2727
const startTime = useRef(0);
2828
const delayedMountTimeoutRef = useRef(null);
2929
const [delayedLoaded, setDelayedLoaded] = useState(false);

‎src/components/popover/popover.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ describe('Popover', () => {
161161
const { baseElement } = render(<PopoverTest {...props} />);
162162
await user.click(screen.getByTestId('trigger'));
163163
await waitFor(() => {
164-
expect(screen.getByRole('dialog', { hidden: true })).toBeInTheDocument();
164+
expect(screen.getByText('Greetings')).toBeInTheDocument();
165165
});
166166
expect(baseElement).toMatchSnapshot();
167167
});

‎src/components/popover/popover.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { getTheme } from '../utils/styles';
77

88
interface Props {
99
children: ReactElement;
10-
content: ReactNode | (() => ReactNode);
10+
content: ReactNode;
1111
active: boolean;
1212
padding?: 'medium' | 'small' | 'none';
1313
coloring?: 'light' | 'dark' | 'warning' | 'error';

‎src/components/select/select.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ describe('Select', () => {
8888
const { baseElement } = render(<SelectTest {...props} />);
8989
await user.click(screen.getByTestId("trigger"));
9090
await waitFor(() => {
91-
expect(screen.getByRole('listbox', { hidden: true })).toBeInTheDocument();
91+
expect(screen.getByText('Humpback whale')).toBeInTheDocument();
9292
});
9393
expect(baseElement).toMatchSnapshot();
9494
});

0 commit comments

Comments
 (0)