@@ -230,7 +230,6 @@ test.describe( 'Cover', () => {
230230 test ( 'z-index of Navigation block inside a Cover block is higher than the other cover inner blocks' , async ( {
231231 editor,
232232 page,
233- coverBlockUtils,
234233 } ) => {
235234 // Insert a Cover block
236235 await editor . insertBlock ( { name : 'core/cover' } ) ;
@@ -282,15 +281,23 @@ test.describe( 'Cover', () => {
282281 . getByRole ( 'button' , { name : 'Open menu' } )
283282 . click ( ) ;
284283
285- const menuZIndex = await coverBlockUtils . calculateZIndexContext (
286- coverBlock . locator ( '.wp-block-navigation__responsive-container' )
284+ // Locate the inner container
285+ const innerContainer = secondCoverBlock . locator (
286+ '.wp-block-cover__inner-container'
287287 ) ;
288288
289- const innerBlocksZIndex = await coverBlockUtils . calculateZIndexContext (
290- secondCoverBlock . locator ( '.wp-block-cover__inner-container' )
291- ) ;
289+ let isClickable ;
290+
291+ try {
292+ isClickable = await innerContainer . click ( {
293+ trial : true ,
294+ timeout : 1000 , // This test will always take 1 second to run.
295+ } ) ;
296+ } catch ( error ) {
297+ isClickable = false ;
298+ }
292299
293- expect ( menuZIndex ) . toBeGreaterThan ( innerBlocksZIndex ) ;
300+ expect ( isClickable ) . toBe ( false ) ;
294301 } ) ;
295302} ) ;
296303
@@ -321,27 +328,4 @@ class CoverBlockUtils {
321328
322329 return filename ;
323330 }
324-
325- async calculateZIndexContext ( element ) {
326- const zIndexResult = await element . evaluate ( ( el ) => {
327- let zIndex = 0 ;
328- let currentElement = el ;
329-
330- while ( currentElement ) {
331- const computedStyle = window . getComputedStyle ( currentElement ) ;
332- const zIndexValue = parseInt ( computedStyle . zIndex , 10 ) ;
333-
334- // If the element creates a new stacking context
335- if ( ! isNaN ( zIndexValue ) ) {
336- zIndex = zIndexValue ;
337- }
338-
339- currentElement = currentElement . parentElement ; // Move up the DOM tree
340- }
341-
342- return zIndex ;
343- } ) ;
344-
345- return zIndexResult ;
346- }
347331}
0 commit comments