diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/animation/test/browser_animation_animation-target.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | devtools/client/inspector/animation/test/browser_animation_animation-target.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-target.js b/devtools/client/inspector/animation/test/browser_animation_animation-target.js new file mode 100644 index 0000000000..e38ae18755 --- /dev/null +++ b/devtools/client/inspector/animation/test/browser_animation_animation-target.js @@ -0,0 +1,61 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test for following AnimationTarget component works. +// * element existance +// * number of elements +// * content of element +// * title of inspect icon + +const TEST_DATA = [ + { expectedTextContent: "div.ball.animated" }, + { expectedTextContent: "div.ball.long" }, +]; + +add_task(async function () { + await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept([".animated", ".long"]); + const { animationInspector, panel } = await openAnimationInspector(); + + info("Checking the animation target elements existance"); + const animationItemEls = panel.querySelectorAll( + ".animation-list .animation-item" + ); + is( + animationItemEls.length, + animationInspector.state.animations.length, + "Number of animation target element should be same to number of animations " + + "that displays" + ); + + for (let i = 0; i < animationItemEls.length; i++) { + const animationItemEl = animationItemEls[i]; + animationItemEl.scrollIntoView(false); + await waitUntil(() => animationItemEl.querySelector(".animation-target")); + + const animationTargetEl = + animationItemEl.querySelector(".animation-target"); + ok( + animationTargetEl, + "The animation target element should be in each animation item element" + ); + + info("Checking the content of animation target"); + const testData = TEST_DATA[i]; + is( + animationTargetEl.textContent, + testData.expectedTextContent, + "The target element's content is correct" + ); + ok( + animationTargetEl.querySelector(".objectBox"), + "objectBox is in the page exists" + ); + ok( + animationTargetEl.querySelector(".highlight-node").title, + INSPECTOR_L10N.getStr("inspector.nodePreview.highlightNodeLabel") + ); + } +}); |