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_select.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_select.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/devtools/client/inspector/animation/test/browser_animation_animation-target_select.js b/devtools/client/inspector/animation/test/browser_animation_animation-target_select.js new file mode 100644 index 0000000000..970778c4c6 --- /dev/null +++ b/devtools/client/inspector/animation/test/browser_animation_animation-target_select.js @@ -0,0 +1,64 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test for following selection feature related AnimationTarget component works: +// * select selected node by clicking on target node + +add_task(async function () { + await addTab(URL_ROOT + "doc_simple_animation.html"); + await removeAnimatedElementsExcept([".multi", ".long"]); + const { animationInspector, panel } = await openAnimationInspector(); + + info("Check initial status"); + is( + panel.querySelectorAll(".animation-item").length, + 3, + "The length of animations should be 3. Two .multi animations and one .long animation" + ); + + info("Check selecting an animated node by clicking on the target node"); + await clickOnTargetNode(animationInspector, panel, 0); + assertNodeFront( + animationInspector.inspector.selection.nodeFront, + "DIV", + "ball multi" + ); + is( + panel.querySelectorAll(".animation-item").length, + 2, + "The length of animations should be 2" + ); + + info("Check if the both target nodes refer to the same node"); + await clickOnTargetNode(animationInspector, panel, 1); + assertNodeFront( + animationInspector.inspector.selection.nodeFront, + "DIV", + "ball multi" + ); + is( + panel.querySelectorAll(".animation-item").length, + 2, + "The length of animations should be 2" + ); +}); + +function assertNodeFront(nodeFront, tagName, classValue) { + is( + nodeFront.tagName, + tagName, + "The highlighted node has the correct tagName" + ); + is( + nodeFront.attributes[0].name, + "class", + "The highlighted node has the correct attributes" + ); + is( + nodeFront.attributes[0].value, + classValue, + "The highlighted node has the correct class" + ); +} |