1- import { screen , waitFor } from "@testing-library/preact" ;
1+ import { screen , waitFor , act } from "@testing-library/preact" ;
22import { getFieldSchemaMap } from "../../../../__test__/data/fieldSchemaMap" ;
33import { waitForHoverOutline } from "../../../../__test__/utils" ;
44import Config from "../../../../configManager/configManager" ;
@@ -56,7 +56,6 @@ describe("When an element is hovered in visual builder mode", () => {
5656 observe : vi . fn ( ) ,
5757 disconnect : vi . fn ( ) ,
5858 } ) ) ;
59-
6059 } ) ;
6160
6261 beforeEach ( ( ) => {
@@ -111,7 +110,9 @@ describe("When an element is hovered in visual builder mode", () => {
111110 } ) ;
112111
113112 test ( "should have outline and custom cursor" , async ( ) => {
114- fileField . dispatchEvent ( mousemoveEvent ) ;
113+ await act ( async ( ) => {
114+ fileField . dispatchEvent ( mousemoveEvent ) ;
115+ } ) ;
115116 await waitForHoverOutline ( ) ;
116117 const hoverOutline = document . querySelector (
117118 "[data-testid='visual-builder__hover-outline']"
@@ -126,7 +127,9 @@ describe("When an element is hovered in visual builder mode", () => {
126127 } ) ;
127128
128129 test ( "should have a outline and custom cursor on the url as well" , async ( ) => {
129- imageField . dispatchEvent ( mousemoveEvent ) ;
130+ await act ( async ( ) => {
131+ imageField . dispatchEvent ( mousemoveEvent ) ;
132+ } ) ;
130133 await waitForHoverOutline ( ) ;
131134
132135 const hoverOutline = document . querySelector (
@@ -214,7 +217,9 @@ describe("When an element is hovered in visual builder mode", () => {
214217 } ) ;
215218
216219 test ( "should have outline and custom cursor" , async ( ) => {
217- container . dispatchEvent ( mousemoveEvent ) ;
220+ await act ( async ( ) => {
221+ container . dispatchEvent ( mousemoveEvent ) ;
222+ } ) ;
218223 await waitForHoverOutline ( ) ;
219224 const hoverOutline = document . querySelector (
220225 "[data-testid='visual-builder__hover-outline']"
@@ -229,7 +234,9 @@ describe("When an element is hovered in visual builder mode", () => {
229234 } ) ;
230235
231236 test ( "should have outline and custom cursor on individual instances" , async ( ) => {
232- firstFileField . dispatchEvent ( mousemoveEvent ) ;
237+ await act ( async ( ) => {
238+ firstFileField . dispatchEvent ( mousemoveEvent ) ;
239+ } ) ;
233240 await waitForHoverOutline ( ) ;
234241 const hoverOutline = document . querySelector (
235242 "[data-testid='visual-builder__hover-outline']"
@@ -247,7 +254,9 @@ describe("When an element is hovered in visual builder mode", () => {
247254 } ) ;
248255
249256 test ( "should have outline and custom cursor on the url" , async ( ) => {
250- firstImageField . dispatchEvent ( mousemoveEvent ) ;
257+ await act ( async ( ) => {
258+ firstImageField . dispatchEvent ( mousemoveEvent ) ;
259+ } ) ;
251260 await waitForHoverOutline ( ) ;
252261 const hoverOutline = document . querySelector (
253262 "[data-testid='visual-builder__hover-outline']"
0 commit comments