diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js')
-rw-r--r-- | devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js b/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js new file mode 100644 index 000000000..904a51f76 --- /dev/null +++ b/devtools/client/debugger/test/mochitest/browser_dbg_search-sources-03.js @@ -0,0 +1,103 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests that while searching for files, the sources list remains unchanged. + */ + +const TAB_URL = EXAMPLE_URL + "doc_editor-mode.html"; + +var gTab, gPanel, gDebugger; +var gSources, gSearchBox; + +function test() { + let options = { + source: EXAMPLE_URL + "code_script-switching-01.js?a=b", + line: 1 + }; + initDebugger(TAB_URL, options).then(([aTab,, aPanel]) => { + gTab = aTab; + gPanel = aPanel; + gDebugger = gPanel.panelWin; + gSources = gDebugger.DebuggerView.Sources; + gSearchBox = gDebugger.DebuggerView.Filtering._searchbox; + + superGenericSearch() + .then(verifySourcesPane) + .then(kindaInterpretableSearch) + .then(verifySourcesPane) + .then(incrediblySpecificSearch) + .then(verifySourcesPane) + .then(returnAndHide) + .then(verifySourcesPane) + .then(() => closeDebuggerAndFinish(gPanel)) + .then(null, aError => { + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); + }); + }); +} + +function waitForMatchFoundAndResultsShown() { + return promise.all([ + once(gDebugger, "popupshown"), + waitForDebuggerEvents(gPanel, gDebugger.EVENTS.FILE_SEARCH_MATCH_FOUND) + ]).then(() => promise.all([ + ensureSourceIs(gPanel, "-01.js"), + ensureCaretAt(gPanel, 1) + ])); +} + +function waitForResultsHidden() { + return once(gDebugger, "popuphidden").then(() => promise.all([ + ensureSourceIs(gPanel, "-01.js"), + ensureCaretAt(gPanel, 1) + ])); +} + +function superGenericSearch() { + let finished = waitForMatchFoundAndResultsShown(); + setText(gSearchBox, "."); + return finished; +} + +function kindaInterpretableSearch() { + let finished = waitForMatchFoundAndResultsShown(); + typeText(gSearchBox, "-0"); + return finished; +} + +function incrediblySpecificSearch() { + let finished = waitForMatchFoundAndResultsShown(); + typeText(gSearchBox, "1.js"); + return finished; +} + +function returnAndHide() { + let finished = waitForResultsHidden(); + EventUtils.sendKey("RETURN", gDebugger); + return finished; +} + +function verifySourcesPane() { + is(gSources.itemCount, 3, + "There should be 3 items present in the sources container."); + is(gSources.visibleItems.length, 3, + "There should be no hidden items in the sources container."); + + ok(gSources.getItemForAttachment(e => e.label == "code_script-switching-01.js"), + "The first source's label should be correct."); + ok(gSources.getItemForAttachment(e => e.label == "code_test-editor-mode"), + "The second source's label should be correct."); + ok(gSources.getItemForAttachment(e => e.label == "doc_editor-mode.html"), + "The third source's label should be correct."); +} + +registerCleanupFunction(function () { + gTab = null; + gPanel = null; + gDebugger = null; + gSources = null; + gSearchBox = null; +}); |