Skip to content

Commit

Permalink
test: add locale test
Browse files Browse the repository at this point in the history
  • Loading branch information
nova1751 committed Apr 23, 2024
1 parent 5efdce5 commit c0c2cca
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions components/typography/__tests__/copy.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,24 @@ describe('Typography copy', () => {
);
expect(container.querySelector('.ant-typography-copy')?.getAttribute('tabIndex')).toBe('-1');
});

it('locale text for button tooltip', async () => {
const { container, rerender } = render(<Base component="p">test</Base>);

rerender(
<Base component="p" copyable={{ tabIndex: -1 }}>
test
</Base>,
);

fireEvent.mouseEnter(container.querySelectorAll('.ant-typography-copy')[0]);
await waitFakeTimer();
await waitFor(() => {
expect(container.querySelector('.ant-tooltip-inner')?.textContent).toBe('Copy');
});
fireEvent.click(container.querySelectorAll('.ant-typography-copy')[0]);
await waitFor(() => {
expect(container.querySelector('.ant-tooltip-inner')?.textContent).toBe('Copied');
});
});
});

0 comments on commit c0c2cca

Please sign in to comment.