Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 function test() {
5 waitForExplicitFinish();
7 window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
8 TabView.toggle();
9 }
11 function onTabViewWindowLoaded() {
12 window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
14 ok(TabView.isVisible(), "Tab View is visible");
16 let [originalTab] = gBrowser.visibleTabs;
17 let contentWindow = document.getElementById("tab-view").contentWindow;
19 // create group which we'll close
20 let box1 = new contentWindow.Rect(310, 10, 300, 300);
21 let group1 = new contentWindow.GroupItem([], { bounds: box1 });
22 ok(group1.isEmpty(), "This group is empty");
23 contentWindow.UI.setActive(group1);
24 let tab1 = gBrowser.loadOneTab("about:blank#1", {inBackground: true});
25 let tab1Item = tab1._tabViewTabItem;
26 ok(group1.getChildren().some(function(child) child == tab1Item), "The tab was made in our new group");
27 is(group1.getChildren().length, 1, "Only one tab in the first group");
29 group1.addSubscriber("close", function onClose() {
30 group1.removeSubscriber("close", onClose);
32 let onTabViewHidden = function() {
33 window.removeEventListener("tabviewhidden", onTabViewHidden, false);
34 // assert that we're no longer in tab view
35 ok(!TabView.isVisible(), "Tab View is hidden");
36 finish();
37 };
38 window.addEventListener("tabviewhidden", onTabViewHidden, false);
40 // delay to give time for hidden group DOM element to be removed so
41 // the appropriate group would get selected when the key
42 // combination is pressed
43 executeSoon(function() {
44 EventUtils.synthesizeKey("e", {accelKey : true, shiftKey: true}, contentWindow);
45 });
46 });
48 hideGroupItem(group1, function () {
49 // close undo group
50 let closeButton = group1.$undoContainer.find(".close");
51 EventUtils.sendMouseEvent(
52 { type: "click" }, closeButton[0], contentWindow);
53 });
54 }