browser_animation_summary-graph_animation-name.js (1599B)
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 AnimationName component works. 7 // * element existance 8 // * name text 9 10 const TEST_DATA = [ 11 { 12 targetClass: "cssanimation-normal", 13 expectedLabel: "cssanimation", 14 }, 15 { 16 targetClass: "cssanimation-linear", 17 expectedLabel: "cssanimation", 18 }, 19 { 20 targetClass: "delay-positive", 21 expectedLabel: "test-delay-animation", 22 }, 23 { 24 targetClass: "delay-negative", 25 expectedLabel: "test-negative-delay-animation", 26 }, 27 { 28 targetClass: "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, expectedLabel } of TEST_DATA) { 38 const animationItemEl = await findAnimationItemByTargetSelector( 39 panel, 40 `.${targetClass}` 41 ); 42 43 info(`Checking animation name element existance for ${targetClass}`); 44 const animationNameEl = animationItemEl.querySelector(".animation-name"); 45 46 if (expectedLabel) { 47 ok( 48 animationNameEl, 49 "The animation name element should be in animation item element" 50 ); 51 is( 52 animationNameEl.textContent, 53 expectedLabel, 54 `The animation name should be ${expectedLabel}` 55 ); 56 } else { 57 ok( 58 !animationNameEl, 59 "The animation name element should not be in animation item element" 60 ); 61 } 62 } 63 });