2011-02-27 17:36:36 -08:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
2010-09-27 16:12:00 -07:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
|
|
|
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
|
|
|
TabView.toggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
function onTabViewWindowLoaded() {
|
|
|
|
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
|
|
|
|
|
|
|
ok(TabView.isVisible(), "Tab View is visible");
|
|
|
|
|
|
|
|
let [originalTab] = gBrowser.visibleTabs;
|
|
|
|
let contentWindow = document.getElementById("tab-view").contentWindow;
|
|
|
|
|
|
|
|
// create group which we'll close
|
|
|
|
let box1 = new contentWindow.Rect(310, 10, 300, 300);
|
|
|
|
let group1 = new contentWindow.GroupItem([], { bounds: box1 });
|
|
|
|
ok(group1.isEmpty(), "This group is empty");
|
2011-04-22 13:05:11 -07:00
|
|
|
contentWindow.UI.setActive(group1);
|
2010-09-27 16:12:00 -07:00
|
|
|
let tab1 = gBrowser.loadOneTab("about:blank#1", {inBackground: true});
|
2011-01-11 00:20:08 -08:00
|
|
|
let tab1Item = tab1._tabViewTabItem;
|
2010-09-27 16:12:00 -07:00
|
|
|
ok(group1.getChildren().some(function(child) child == tab1Item), "The tab was made in our new group");
|
|
|
|
is(group1.getChildren().length, 1, "Only one tab in the first group");
|
|
|
|
|
2011-07-14 10:54:25 -07:00
|
|
|
group1.addSubscriber("close", function onClose() {
|
|
|
|
group1.removeSubscriber("close", onClose);
|
2010-09-27 16:12:00 -07:00
|
|
|
|
|
|
|
let onTabViewHidden = function() {
|
|
|
|
window.removeEventListener("tabviewhidden", onTabViewHidden, false);
|
|
|
|
// assert that we're no longer in tab view
|
|
|
|
ok(!TabView.isVisible(), "Tab View is hidden");
|
|
|
|
finish();
|
|
|
|
};
|
|
|
|
window.addEventListener("tabviewhidden", onTabViewHidden, false);
|
|
|
|
|
2010-11-23 10:49:50 -08:00
|
|
|
// delay to give time for hidden group DOM element to be removed so
|
|
|
|
// the appropriate group would get selected when the key
|
|
|
|
// combination is pressed
|
|
|
|
executeSoon(function() {
|
2011-06-30 00:25:26 -07:00
|
|
|
EventUtils.synthesizeKey("e", {accelKey : true, shiftKey: true}, contentWindow);
|
2010-11-23 10:49:50 -08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2011-07-14 10:54:25 -07:00
|
|
|
hideGroupItem(group1, function () {
|
2010-11-23 10:49:50 -08:00
|
|
|
// close undo group
|
|
|
|
let closeButton = group1.$undoContainer.find(".close");
|
|
|
|
EventUtils.sendMouseEvent(
|
|
|
|
{ type: "click" }, closeButton[0], contentWindow);
|
2010-09-27 16:12:00 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|