browser/components/tabview/test/browser_tabview_bug587351.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 let newTab;
michael@0 5
michael@0 6 function test() {
michael@0 7 waitForExplicitFinish();
michael@0 8
michael@0 9 newTab = gBrowser.addTab();
michael@0 10
michael@0 11 window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
michael@0 12 TabView.toggle();
michael@0 13 }
michael@0 14
michael@0 15 function onTabViewWindowLoaded() {
michael@0 16 window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
michael@0 17
michael@0 18 let contentWindow = document.getElementById("tab-view").contentWindow;
michael@0 19 is(contentWindow.GroupItems.groupItems.length, 1, "Has one group only");
michael@0 20
michael@0 21 let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
michael@0 22 ok(tabItems.length, 2, "There are two tabItems in the group");
michael@0 23
michael@0 24 is(tabItems[1].tab, newTab, "The second tabItem is linked to the new tab");
michael@0 25
michael@0 26 EventUtils.sendMouseEvent({ type: "mousedown", button: 1 }, tabItems[1].container, contentWindow);
michael@0 27 EventUtils.sendMouseEvent({ type: "mouseup", button: 1 }, tabItems[1].container, contentWindow);
michael@0 28
michael@0 29 ok(tabItems.length, 1, "There is only one tabItem in the group");
michael@0 30
michael@0 31 let endGame = function() {
michael@0 32 window.removeEventListener("tabviewhidden", endGame, false);
michael@0 33
michael@0 34 finish();
michael@0 35 };
michael@0 36 window.addEventListener("tabviewhidden", endGame, false);
michael@0 37 TabView.toggle();
michael@0 38 }

mercurial