Skip to content

Commit

Permalink
test: fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Apr 10, 2024
1 parent fbb88f0 commit b87d7fc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/BaseSelect.test.tsx
@@ -1,5 +1,5 @@
import type { OptionListProps, RefOptionListProps } from '@/OptionList';
import { fireEvent, render } from '@testing-library/react';
import { act, fireEvent, render } from '@testing-library/react';
import { forwardRef } from 'react';
import BaseSelect from '../src/BaseSelect';

Expand Down Expand Up @@ -34,6 +34,7 @@ describe('BaseSelect', () => {
fireEvent.click(container.querySelector('a.trigger'));
expect(container.querySelector('div.rc-select-dropdown-hidden')).toBeTruthy();
});

it('customized inputElement style should includes position: absolute', () => {
jest.useFakeTimers();
const { container } = render(
Expand All @@ -50,7 +51,9 @@ describe('BaseSelect', () => {
);
expect(container.querySelector('div.rc-select')).toBeTruthy();
fireEvent.focus(container.querySelector('div.rc-select'));
jest.runAllTimers();
act(() => {
jest.runAllTimers();
});
expect(
getComputedStyle(container.querySelector(`span[aria-live=polite]`)).getPropertyValue(
'position',
Expand Down

0 comments on commit b87d7fc

Please sign in to comment.