browser_animation_summary-graph_effect-timing-path.js (1607B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test for following EffectTimingPath component works. 7 // * element existance 8 // * path 9 10 const TEST_DATA = [ 11 { 12 targetClass: "cssanimation-linear", 13 }, 14 { 15 targetClass: "delay-negative", 16 }, 17 { 18 targetClass: "easing-step", 19 expectedPath: [ 20 { x: 0, y: 0 }, 21 { x: 499999, y: 0 }, 22 { x: 500000, y: 50 }, 23 { x: 999999, y: 50 }, 24 { x: 1000000, y: 0 }, 25 ], 26 }, 27 { 28 targetClass: "keyframes-easing-step", 29 }, 30 ]; 31 32 add_task(async function () { 33 await addTab(URL_ROOT + "doc_multi_timings.html"); 34 await removeAnimatedElementsExcept(TEST_DATA.map(t => `.${t.targetClass}`)); 35 const { panel } = await openAnimationInspector(); 36 37 for (const { targetClass, expectedPath } of TEST_DATA) { 38 const animationItemEl = await findAnimationItemByTargetSelector( 39 panel, 40 `.${targetClass}` 41 ); 42 43 info(`Checking effect timing path existance for ${targetClass}`); 44 const effectTimingPathEl = animationItemEl.querySelector( 45 ".animation-effect-timing-path" 46 ); 47 48 if (expectedPath) { 49 ok( 50 effectTimingPathEl, 51 "The effect timing path element should be in animation item element" 52 ); 53 const pathEl = effectTimingPathEl.querySelector( 54 ".animation-iteration-path" 55 ); 56 assertPathSegments(pathEl, false, expectedPath); 57 } else { 58 ok( 59 !effectTimingPathEl, 60 "The effect timing path element should not be in animation item element" 61 ); 62 } 63 } 64 });