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/debugger/test/mochitest/browser_dbg-outline.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 'devtools/client/debugger/test/mochitest/browser_dbg-outline.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg-outline.js | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-outline.js b/devtools/client/debugger/test/mochitest/browser_dbg-outline.js new file mode 100644 index 0000000000..6048a7a92d --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg-outline.js @@ -0,0 +1,93 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ + +// Tests that outline panel can sort functions alphabetically. + +"use strict"; + +add_task(async function () { + const dbg = await initDebugger("doc-scripts.html", "simple1.js"); + + openOutlinePanel(dbg, false); + + is( + findAllElements(dbg, "outlineItems").length, + 0, + " There are no outline items when no source is selected" + ); + is( + findElementWithSelector(dbg, ".outline-pane-info").innerText, + "No file selected", + "The correct message is displayed when there are no outline items" + ); + + const sourcesTab = findElementWithSelector(dbg, ".sources-tab a"); + EventUtils.synthesizeMouseAtCenter(sourcesTab, {}, sourcesTab.ownerGlobal); + await waitForSourcesInSourceTree(dbg, [], { noExpand: true }); + + await selectSource(dbg, "simple1.js", 1); + + await openOutlinePanel(dbg); + + assertOutlineItems(dbg, [ + "λmain()", + "λdoEval()", + "λevaledFunc()", + "λdoNamedEval()", + // evaledFunc is set twice + "λevaledFunc()", + "class MyClass", + "λconstructor(a, b)", + "λtest()", + "λ#privateFunc(a, b)", + "class Klass", + "λconstructor()", + "λtest()", + ]); + + info("Sort the list"); + findElementWithSelector(dbg, ".outline-footer button").click(); + // Button becomes active to show alphabetization + is( + findElementWithSelector(dbg, ".outline-footer button").className, + "active", + "Alphabetize button is highlighted when active" + ); + + info("Check that the list was sorted as expected"); + assertOutlineItems(dbg, [ + "λdoEval()", + "λdoNamedEval()", + // evaledFunc is set twice + "λevaledFunc()", + "λevaledFunc()", + "λmain()", + "class Klass", + "λconstructor()", + "λtest()", + "class MyClass", + "λ#privateFunc(a, b)", + "λconstructor(a, b)", + "λtest()", + ]); +}); + +// Test empty panel when source has not function or class symbols +add_task(async function () { + const dbg = await initDebugger("doc-on-load.html", "top-level.js"); + await selectSource(dbg, "top-level.js", 1); + + openOutlinePanel(dbg, false); + await waitFor( + () => + dbg.win.document.querySelector(".outline-pane-info").innerText == + "No functions" + ); + + is( + findAllElements(dbg, "outlineItems").length, + 0, + " There are no outline items when no source is selected" + ); +}); |