diff --git a/packages/@headlessui-react/src/components/transitions/transition.test.tsx b/packages/@headlessui-react/src/components/transitions/transition.test.tsx index aa384d2ba4..471fca4060 100644 --- a/packages/@headlessui-react/src/components/transitions/transition.test.tsx +++ b/packages/@headlessui-react/src/components/transitions/transition.test.tsx @@ -1,11 +1,13 @@ import React, { Fragment, useState, useRef, useLayoutEffect, useEffect } from 'react' -import { render, fireEvent } from '@testing-library/react' +import { render, fireEvent, act as _act } from '@testing-library/react' import { suppressConsoleLogs } from '../../test-utils/suppress-console-logs' import { Transition } from './transition' import { executeTimeline } from '../../test-utils/execute-timeline' +let act = _act as unknown as (fn: () => T) => PromiseLike + function nextFrame() { return new Promise((resolve) => { requestAnimationFrame(() => { @@ -423,22 +425,26 @@ describe('Setup API', () => { `) }) - it('should be possible to passthrough the transition classes and immediately apply the enter transitions when appear is set to true', () => { - let { container } = render( - - Children - + it('should be possible to passthrough the transition classes and immediately apply the enter transitions when appear is set to true', async () => { + let { container } = await act(() => + render( + + Children + + ) ) + expect(container).toBeDefined() + expect(container.firstChild).toMatchInlineSnapshot(`