2011-02-27 17:36:36 -08:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
2010-11-23 23:55:18 -08:00
|
|
|
|
2011-05-19 15:07:55 -07:00
|
|
|
let win;
|
|
|
|
let cw;
|
2010-11-23 23:55:18 -08:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
2011-05-19 15:07:55 -07:00
|
|
|
let onLoad = function (tvwin) {
|
|
|
|
win = tvwin;
|
|
|
|
registerCleanupFunction(function () win.close());
|
|
|
|
win.gBrowser.loadOneTab("http://mochi.test:8888/", {inBackground: true});
|
|
|
|
};
|
2010-11-23 23:55:18 -08:00
|
|
|
|
2011-05-19 15:07:55 -07:00
|
|
|
let onShow = function () {
|
|
|
|
cw = win.TabView.getContentWindow();
|
|
|
|
ok(win.TabView.isVisible(), "Tab View is visible");
|
|
|
|
afterAllTabItemsUpdated(testOne, win);
|
|
|
|
};
|
2010-11-23 23:55:18 -08:00
|
|
|
|
2011-05-19 15:07:55 -07:00
|
|
|
newWindowWithTabView(onShow, onLoad);
|
2010-11-23 23:55:18 -08:00
|
|
|
}
|
|
|
|
|
2011-05-19 15:07:55 -07:00
|
|
|
function testOne() {
|
2011-06-22 20:42:50 -07:00
|
|
|
hideSearchWhenSearchEnabled(testTwo);
|
2011-03-28 19:51:26 -07:00
|
|
|
// press cmd/ctrl F
|
2011-05-19 15:07:55 -07:00
|
|
|
EventUtils.synthesizeKey("f", {accelKey: true}, cw);
|
2010-11-23 23:55:18 -08:00
|
|
|
}
|
|
|
|
|
2011-05-19 15:07:55 -07:00
|
|
|
function testTwo() {
|
2011-06-22 20:42:50 -07:00
|
|
|
hideSearchWhenSearchEnabled(testThree);
|
2010-11-23 23:55:18 -08:00
|
|
|
// press /
|
2011-05-19 15:07:55 -07:00
|
|
|
EventUtils.synthesizeKey("VK_SLASH", {}, cw);
|
2010-11-23 23:55:18 -08:00
|
|
|
}
|
|
|
|
|
2011-05-19 15:07:55 -07:00
|
|
|
function testThree() {
|
2011-06-22 20:42:50 -07:00
|
|
|
ok(win.TabView.isVisible(), "Tab View is visible");
|
|
|
|
// create another group with a tab.
|
|
|
|
let groupItem = createGroupItemWithBlankTabs(win, 300, 300, 200, 1);
|
|
|
|
is(cw.UI.getActiveTab(), groupItem.getChild(0),
|
|
|
|
"The active tab is newly created tab item");
|
|
|
|
|
|
|
|
whenSearchIsEnabled(function () {
|
|
|
|
let doc = cw.document;
|
|
|
|
let searchBox = cw.iQ("#searchbox");
|
|
|
|
let hasFocus = doc.hasFocus() && doc.activeElement == searchBox[0];
|
|
|
|
ok(hasFocus, "The search box has focus");
|
|
|
|
|
|
|
|
let tab = win.gBrowser.tabs[1];
|
|
|
|
searchBox.val(tab._tabViewTabItem.$tabTitle[0].innerHTML);
|
|
|
|
|
2011-09-29 21:17:00 -07:00
|
|
|
cw.Search.perform();
|
2011-06-22 20:42:50 -07:00
|
|
|
|
|
|
|
whenTabViewIsHidden(function () {
|
|
|
|
is(tab, win.gBrowser.selectedTab, "The search result tab is shown");
|
|
|
|
finish()
|
|
|
|
}, win);
|
|
|
|
|
|
|
|
// use the tabview menu (the same as pressing cmd/ctrl + e)
|
|
|
|
win.document.getElementById("menu_tabview").doCommand();
|
2011-05-19 15:07:55 -07:00
|
|
|
}, win);
|
2011-06-22 20:42:50 -07:00
|
|
|
EventUtils.synthesizeKey("VK_SLASH", {}, cw);
|
2010-11-23 23:55:18 -08:00
|
|
|
}
|
|
|
|
|
2011-06-22 20:42:50 -07:00
|
|
|
function hideSearchWhenSearchEnabled(callback) {
|
|
|
|
whenSearchIsEnabled(function() {
|
|
|
|
hideSearch(callback, win);
|
|
|
|
}, win);
|
2010-11-23 23:55:18 -08:00
|
|
|
}
|
|
|
|
|