2013-09-13 06:23:17 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Make sure that the searchbox popup is displayed when focusing the searchbox,
|
|
|
|
* and hidden when the user starts typing.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
|
|
|
|
|
2014-11-18 04:05:28 -08:00
|
|
|
let gTab, gPanel, gDebugger;
|
2013-10-22 13:53:53 -07:00
|
|
|
let gSearchBox, gSearchBoxPanel;
|
2013-09-13 06:23:17 -07:00
|
|
|
|
|
|
|
function test() {
|
2014-11-18 04:05:28 -08:00
|
|
|
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
|
2013-09-13 06:23:17 -07:00
|
|
|
gTab = aTab;
|
|
|
|
gPanel = aPanel;
|
|
|
|
gDebugger = gPanel.panelWin;
|
|
|
|
gSearchBox = gDebugger.DebuggerView.Filtering._searchbox;
|
|
|
|
gSearchBoxPanel = gDebugger.DebuggerView.Filtering._searchboxHelpPanel;
|
|
|
|
|
2014-02-04 13:23:20 -08:00
|
|
|
waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1)
|
2013-09-13 06:23:19 -07:00
|
|
|
.then(showPopup)
|
|
|
|
.then(hidePopup)
|
2013-09-13 06:23:17 -07:00
|
|
|
.then(() => resumeDebuggerThenCloseAndFinish(gPanel))
|
|
|
|
.then(null, aError => {
|
|
|
|
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
|
|
|
});
|
|
|
|
|
2014-11-18 04:05:28 -08:00
|
|
|
callInTab(gTab, "firstCall");
|
2013-09-13 06:23:17 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function showPopup() {
|
|
|
|
is(gSearchBoxPanel.state, "closed",
|
|
|
|
"The search box panel shouldn't be visible yet.");
|
|
|
|
|
|
|
|
let finished = once(gSearchBoxPanel, "popupshown");
|
|
|
|
EventUtils.sendMouseEvent({ type: "click" }, gSearchBox, gDebugger);
|
|
|
|
return finished;
|
|
|
|
}
|
|
|
|
|
|
|
|
function hidePopup() {
|
|
|
|
is(gSearchBoxPanel.state, "open",
|
|
|
|
"The search box panel should be visible after searching started.");
|
|
|
|
|
|
|
|
let finished = once(gSearchBoxPanel, "popuphidden");
|
|
|
|
setText(gSearchBox, "#");
|
|
|
|
return finished;
|
|
|
|
}
|
|
|
|
|
|
|
|
registerCleanupFunction(function() {
|
|
|
|
gTab = null;
|
|
|
|
gPanel = null;
|
|
|
|
gDebugger = null;
|
|
|
|
gSearchBox = null;
|
|
|
|
gSearchBoxPanel = null;
|
|
|
|
});
|