@@ -3,6 +3,14 @@ import { getTodoText } from "../resources/shared/translations.mjs";
33import { getNumberOfItemsToAdd } from "../resources/shared/todomvc-utils.mjs" ;
44import { freezeSuites } from "../resources/suites-helper.mjs" ;
55
6+ function reportRecipeCarouselResizeEvents ( stepName , resizeEvents ) {
7+ const count = resizeEvents . stop ( ) ;
8+ if ( count )
9+ console . warn ( `${ stepName } : recipe-carousel ResizeObserver reported ${ count } width change(s).` ) ;
10+ else
11+ console . warn ( `${ stepName } : recipe-carousel ResizeObserver reported 0 width changes; expected width changes during iframe resize.` ) ;
12+ }
13+
614export const ExperimentalSuites = freezeSuites ( [
715 {
816 name : "TodoMVC-LocalStorage" ,
@@ -214,6 +222,7 @@ export const ExperimentalSuites = freezeSuites([
214222 new BenchmarkTestStep ( "ReduceWidthIn5Steps" , async ( page ) => {
215223 const widths = [ 768 , 704 , 640 , 560 , 480 ] ;
216224 const MATCH_MEDIA_QUERY_BREAKPOINT = 640 ;
225+ const carouselResizeEvents = await page . querySelector ( ".carousel" , [ "cooking-app" , "main-content" , "recipe-carousel" ] ) . observeResizeEvents ( ) ;
217226
218227 // The matchMedia query is "(max-width: 640px)"
219228 // Starting from a width > 640px, we'll only get 1 event when crossing to <= 640px
@@ -230,6 +239,7 @@ export const ExperimentalSuites = freezeSuites([
230239 }
231240
232241 await new Promise ( ( resolve ) => requestAnimationFrame ( ( ) => requestAnimationFrame ( resolve ) ) ) ;
242+ reportRecipeCarouselResizeEvents ( "ReduceWidthIn5Steps" , carouselResizeEvents ) ;
233243 } ) ,
234244 new BenchmarkTestStep ( "ScrollToChatAndSendMessages" , async ( page ) => {
235245 const cvWorkComplete = new Promise ( ( resolve ) => {
@@ -273,6 +283,7 @@ export const ExperimentalSuites = freezeSuites([
273283 new BenchmarkTestStep ( "IncreaseWidthIn5Steps" , async ( page ) => {
274284 const widths = [ 560 , 640 , 704 , 768 , 800 ] ;
275285 const MATCH_MEDIA_QUERY_BREAKPOINT = 704 ;
286+ const carouselResizeEvents = await page . querySelector ( ".carousel" , [ "cooking-app" , "main-content" , "recipe-carousel" ] ) . observeResizeEvents ( ) ;
276287
277288 // The matchMedia query is "(max-width: 640px)"
278289 // Starting from a width <= 640px, we'll get 1 event when crossing back to > 640px.
@@ -289,6 +300,7 @@ export const ExperimentalSuites = freezeSuites([
289300 }
290301
291302 await new Promise ( ( resolve ) => requestAnimationFrame ( ( ) => requestAnimationFrame ( resolve ) ) ) ;
303+ reportRecipeCarouselResizeEvents ( "IncreaseWidthIn5Steps" , carouselResizeEvents ) ;
292304 } ) ,
293305 ] ,
294306 } ,
0 commit comments