зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1431576 - Part 4: Add test for selection of animation item. r=jdescottes
MozReview-Commit-ID: 46qhbjnRNGd --HG-- extra : rebase_source : 355f227101f54be92b800f808ffd22cf5ac95809
This commit is contained in:
Родитель
b1d89cfcc6
Коммит
742cfdad99
|
@ -26,6 +26,8 @@ support-files =
|
|||
[browser_animation_animation-detail_title.js]
|
||||
[browser_animation_animation-detail_visibility.js]
|
||||
[browser_animation_animation-list.js]
|
||||
[browser_animation_animation-list_one-animation-select.js]
|
||||
[browser_animation_animation-list_select.js]
|
||||
[browser_animation_animation-target.js]
|
||||
[browser_animation_animation-target_highlight.js]
|
||||
[browser_animation_animation-target_select.js]
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test whether the animation item has been selected from first time
|
||||
// if count of the animations is one.
|
||||
|
||||
add_task(async function() {
|
||||
await addTab(URL_ROOT + "doc_simple_animation.html");
|
||||
await removeAnimatedElementsExcept([".animated"]);
|
||||
const { panel } = await openAnimationInspector();
|
||||
|
||||
info("Checking whether an item element has been selected");
|
||||
is(panel.querySelector(".animation-item").classList.contains("selected"), true,
|
||||
"The animation item should have 'selected' class");
|
||||
|
||||
info("Checking whether the element will be unselected after closing the detail pane");
|
||||
clickOnDetailCloseButton(panel);
|
||||
is(panel.querySelector(".animation-item").classList.contains("selected"), false,
|
||||
"The animation item should not have 'selected' class");
|
||||
});
|
|
@ -0,0 +1,33 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Test whether the animation items in the list were selectable.
|
||||
|
||||
add_task(async function() {
|
||||
await addTab(URL_ROOT + "doc_simple_animation.html");
|
||||
await removeAnimatedElementsExcept([".animated", ".long"]);
|
||||
const { animationInspector, panel } = await openAnimationInspector();
|
||||
|
||||
info("Checking whether 1st element will be selected");
|
||||
await clickOnAnimation(animationInspector, panel, 0);
|
||||
assertSelection(panel, [true, false]);
|
||||
|
||||
info("Checking whether 2nd element will be selected");
|
||||
await clickOnAnimation(animationInspector, panel, 1);
|
||||
assertSelection(panel, [false, true]);
|
||||
|
||||
info("Checking whether all elements will be unselected after closing the detail pane");
|
||||
clickOnDetailCloseButton(panel);
|
||||
assertSelection(panel, [false, false]);
|
||||
});
|
||||
|
||||
function assertSelection(panel, expectedResult) {
|
||||
panel.querySelectorAll(".animation-item").forEach((item, index) => {
|
||||
const shouldSelected = expectedResult[index];
|
||||
is(item.classList.contains("selected"), shouldSelected,
|
||||
`Animation item[${ index }] should ` +
|
||||
`${ shouldSelected ? "" : "not" } have 'selected' class`);
|
||||
});
|
||||
}
|
Загрузка…
Ссылка в новой задаче