File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
packages/react-core/src/components Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1- import { screen , render } from '@testing-library/react' ;
1+ import { screen , render , waitFor } from '@testing-library/react' ;
22import userEvent from '@testing-library/user-event' ;
33
44import { HelperText , HelperTextItem } from '../../HelperText' ;
@@ -93,6 +93,11 @@ test('With popover opened', async () => {
9393
9494 await user . click ( screen . getByRole ( 'button' , { name : 'Toggle date picker' } ) ) ;
9595 await screen . findByRole ( 'button' , { name : 'Previous month' } ) ;
96+ // Wait for popper opacity transition after requestAnimationFrame
97+ await waitFor ( ( ) => {
98+ const popover = screen . getByRole ( 'dialog' ) ;
99+ expect ( popover ) . toHaveStyle ( { opacity : '1' } ) ;
100+ } ) ;
96101
97102 expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
98103} ) ;
Original file line number Diff line number Diff line change 11import { StrictMode } from 'react' ;
2- import { render , screen } from '@testing-library/react' ;
2+ import { render , screen , waitFor } from '@testing-library/react' ;
33import userEvent from '@testing-library/user-event' ;
44import '@testing-library/jest-dom' ;
55
@@ -242,6 +242,11 @@ describe('Nav', () => {
242242 ) ;
243243
244244 await user . hover ( screen . getByText ( 'My custom node' ) ) ;
245+ // Wait for popper opacity transition after requestAnimationFrame
246+ await waitFor ( ( ) => {
247+ const flyout = screen . getByText ( 'Flyout test' ) . parentElement ;
248+ expect ( flyout ) . toHaveStyle ( { opacity : '1' } ) ;
249+ } ) ;
245250 expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
246251 } ) ;
247252
Original file line number Diff line number Diff line change 11import { StrictMode } from 'react' ;
2- import { render , screen } from '@testing-library/react' ;
2+ import { render , screen , waitFor } from '@testing-library/react' ;
33import userEvent from '@testing-library/user-event' ;
44
55import { SearchInput } from '../SearchInput' ;
@@ -151,6 +151,11 @@ describe('SearchInput', () => {
151151 expect ( screen . getByTestId ( 'test-id' ) ) . toContainElement ( screen . getByText ( 'First name' ) ) ;
152152
153153 expect ( props . onSearch ) . toHaveBeenCalled ( ) ;
154+ // Wait for popper opacity transition after requestAnimationFrame
155+ await waitFor ( ( ) => {
156+ const panel = screen . getByText ( 'First name' ) . closest ( '.pf-v6-c-panel' ) ;
157+ expect ( panel ?. parentElement ) . toHaveStyle ( { opacity : '1' } ) ;
158+ } ) ;
154159 expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
155160 } ) ;
156161
You can’t perform that action at this time.
0 commit comments