зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1427006 - Enhanced the browser_webconsole_console_group test; r=nchevobbe
MozReview-Commit-ID: Efe5xb8sq7C --HG-- extra : rebase_source : 6194d5f4af96446162fcf9b2324fe596e4f299d4
This commit is contained in:
Родитель
797df76226
Коммит
b2c45cf368
|
@ -31,46 +31,70 @@ add_task(async function () {
|
|||
info("messages : " + JSON.stringify(messages));
|
||||
});
|
||||
|
||||
const onMessagesLogged = waitForMessage(hud, "log-6");
|
||||
ContentTask.spawn(gBrowser.selectedBrowser, null, function () {
|
||||
content.wrappedJSObject.doLog();
|
||||
});
|
||||
await onMessagesLogged;
|
||||
|
||||
info("Test a group at root level");
|
||||
let node = await waitFor(() => findMessage(hud, "group-1"));
|
||||
let node = findMessage(hud, "group-1");
|
||||
testClass(node, "startGroup");
|
||||
testIndent(node, 0);
|
||||
testGroupToggle({
|
||||
node,
|
||||
store,
|
||||
shouldBeOpen: true,
|
||||
visibleMessageIdsAfterExpand: ["1","2","3","4","6","8","9","12"],
|
||||
visibleMessageIdsAfterCollapse: ["1","8","9","12"],
|
||||
});
|
||||
|
||||
info("Test a message in a 1 level deep group");
|
||||
node = await waitFor(() => findMessage(hud, "log-1"), undefined, 200);
|
||||
node = findMessage(hud, "log-1");
|
||||
testClass(node, "log");
|
||||
testIndent(node, 1);
|
||||
|
||||
info("Test a group in a 1 level deep group");
|
||||
node = await waitFor(() => findMessage(hud, "group-2"));
|
||||
node = findMessage(hud, "group-2");
|
||||
testClass(node, "startGroup");
|
||||
testIndent(node, 1);
|
||||
testGroupToggle({
|
||||
node,
|
||||
store,
|
||||
shouldBeOpen: true,
|
||||
visibleMessageIdsAfterExpand: ["1","2","3","4","6","8","9","12"],
|
||||
visibleMessageIdsAfterCollapse: ["1","2","3","6","8","9","12"],
|
||||
});
|
||||
|
||||
info("Test a message in a 2 level deep group");
|
||||
node = await waitFor(() => findMessage(hud, "log-2"));
|
||||
node = findMessage(hud, "log-2");
|
||||
testClass(node, "log");
|
||||
testIndent(node, 2);
|
||||
|
||||
info("Test a message in a 1 level deep group, after closing a 2 level deep group");
|
||||
node = await waitFor(() => findMessage(hud, "log-3"));
|
||||
node = findMessage(hud, "log-3");
|
||||
testClass(node, "log");
|
||||
testIndent(node, 1);
|
||||
|
||||
info("Test a message at root level, after closing all the groups");
|
||||
node = await waitFor(() => findMessage(hud, "log-4"));
|
||||
node = findMessage(hud, "log-4");
|
||||
testClass(node, "log");
|
||||
testIndent(node, 0);
|
||||
|
||||
info("Test a collapsed group at root level");
|
||||
node = await waitFor(() => findMessage(hud, "group-3"));
|
||||
node = findMessage(hud, "group-3");
|
||||
testClass(node, "startGroupCollapsed");
|
||||
testIndent(node, 0);
|
||||
testGroupToggle({
|
||||
node,
|
||||
store,
|
||||
shouldBeOpen: false,
|
||||
visibleMessageIdsAfterExpand: ["1","2","3","4","6","8","9","10","12"],
|
||||
visibleMessageIdsAfterCollapse: ["1","2","3","4","6","8","9","12"]
|
||||
});
|
||||
|
||||
info("Test a message at root level, after closing a collapsed group");
|
||||
node = await waitFor(() => findMessage(hud, "log-6"));
|
||||
node = findMessage(hud, "log-6");
|
||||
testClass(node, "log");
|
||||
testIndent(node, 0);
|
||||
let nodes = hud.ui.outputNode.querySelectorAll(".message");
|
||||
|
@ -86,3 +110,27 @@ function testIndent(node, indent) {
|
|||
is(node.querySelector(".indent").style.width, indent,
|
||||
"message has the expected level of indentation");
|
||||
}
|
||||
|
||||
function testGroupToggle({ node, store, shouldBeOpen,
|
||||
visibleMessageIdsAfterExpand, visibleMessageIdsAfterCollapse }) {
|
||||
let toggleArrow = node.querySelector(".theme-twisty");
|
||||
const isOpen = node => node.classList.contains("open");
|
||||
const assertVisibleMessageIds = (expanded) => {
|
||||
let visibleMessageIds = store.getState().messages.visibleMessages;
|
||||
expanded ? is(visibleMessageIds.toString(), visibleMessageIdsAfterExpand.toString()) :
|
||||
is(visibleMessageIds.toString(), visibleMessageIdsAfterCollapse.toString());
|
||||
}
|
||||
|
||||
is(isOpen(node), shouldBeOpen);
|
||||
assertVisibleMessageIds(shouldBeOpen);
|
||||
|
||||
toggleArrow.click();
|
||||
shouldBeOpen = !shouldBeOpen;
|
||||
is(isOpen(node), shouldBeOpen);
|
||||
assertVisibleMessageIds(shouldBeOpen);
|
||||
|
||||
toggleArrow.click();
|
||||
shouldBeOpen = !shouldBeOpen;
|
||||
is(isOpen(node), shouldBeOpen);
|
||||
assertVisibleMessageIds(shouldBeOpen);
|
||||
}
|
Загрузка…
Ссылка в новой задаче