browser_animation_logic_scroll-amount.js (2149B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test whether the scroll amount of animation and animated property re-calculate after 7 // changing selected node. 8 9 add_task(async function () { 10 await addTab(URL_ROOT + "doc_simple_animation.html"); 11 await removeAnimatedElementsExcept([ 12 ".animated", 13 ".multi", 14 ".longhand", 15 ".negative-delay", 16 ]); 17 const { animationInspector, inspector, panel } = 18 await openAnimationInspector(); 19 20 info( 21 "Set the scroll amount of animation and animated property to the bottom" 22 ); 23 const onDetailRendered = animationInspector.once( 24 "animation-keyframes-rendered" 25 ); 26 await clickOnAnimationByTargetSelector( 27 animationInspector, 28 panel, 29 ".longhand" 30 ); 31 await onDetailRendered; 32 33 await waitUntil(() => panel.querySelectorAll(".animation-item").length === 5); 34 const bottomAnimationEl = await findAnimationItemByIndex(panel, 4); 35 const bottomAnimatedPropertyEl = panel.querySelector( 36 ".animated-property-item:last-child" 37 ); 38 bottomAnimationEl.scrollIntoView(false); 39 bottomAnimatedPropertyEl.scrollIntoView(false); 40 41 info("Hold the scroll amount"); 42 const animationInspectionPanel = bottomAnimationEl.closest( 43 ".progress-inspection-panel" 44 ); 45 const animatedPropertyInspectionPanel = bottomAnimatedPropertyEl.closest( 46 ".progress-inspection-panel" 47 ); 48 const initialScrollTopOfAnimation = animationInspectionPanel.scrollTop; 49 const initialScrollTopOfAnimatedProperty = 50 animatedPropertyInspectionPanel.scrollTop; 51 52 info( 53 "Check whether the scroll amount re-calculate after changing the count of items" 54 ); 55 await selectNode(".negative-delay", inspector); 56 await waitUntil( 57 () => 58 initialScrollTopOfAnimation > animationInspectionPanel.scrollTop && 59 initialScrollTopOfAnimatedProperty > 60 animatedPropertyInspectionPanel.scrollTop 61 ); 62 ok( 63 true, 64 "Scroll amount for animation list should be less than previous state" 65 ); 66 ok( 67 true, 68 "Scroll amount for animated property list should be less than previous state" 69 ); 70 });