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-26 09:50:39 -08:00
|
|
|
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
|
|
|
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
|
|
|
TabView.toggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
let moves = 0;
|
|
|
|
let contentWindow = null;
|
|
|
|
let newTabs = [];
|
|
|
|
let originalTab = null;
|
|
|
|
|
|
|
|
function onTabMove(e) {
|
|
|
|
let tab = e.target;
|
|
|
|
moves++;
|
|
|
|
}
|
|
|
|
|
|
|
|
function onTabViewWindowLoaded() {
|
|
|
|
window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
|
|
|
|
|
|
|
|
contentWindow = document.getElementById("tab-view").contentWindow;
|
|
|
|
|
|
|
|
originalTab = gBrowser.selectedTab;
|
2011-01-26 13:38:00 -08:00
|
|
|
newTabs = [gBrowser.addTab("about:robots"), gBrowser.addTab("about:mozilla"), gBrowser.addTab("about:license")];
|
2010-11-26 09:50:39 -08:00
|
|
|
|
|
|
|
is(originalTab._tPos, 0, "Original tab is in position 0");
|
|
|
|
is(newTabs[0]._tPos, 1, "Robots is in position 1");
|
|
|
|
is(newTabs[1]._tPos, 2, "Mozilla is in position 2");
|
2011-01-26 13:38:00 -08:00
|
|
|
is(newTabs[2]._tPos, 3, "License is in position 3");
|
2010-11-26 09:50:39 -08:00
|
|
|
|
|
|
|
gBrowser.tabContainer.addEventListener("TabMove", onTabMove, false);
|
|
|
|
|
2011-01-18 04:25:59 -08:00
|
|
|
let groupItem = contentWindow.GroupItems.getActiveGroupItem();
|
2010-11-26 09:50:39 -08:00
|
|
|
|
|
|
|
// move 3 > 0 (and therefore 0 > 1, 1 > 2, 2 > 3)
|
|
|
|
groupItem._children.splice(0, 0, groupItem._children.splice(3, 1)[0]);
|
|
|
|
groupItem.arrange();
|
|
|
|
|
|
|
|
window.addEventListener("tabviewhidden", onTabViewWindowHidden, false);
|
|
|
|
TabView.toggle();
|
|
|
|
}
|
|
|
|
|
|
|
|
function onTabViewWindowHidden() {
|
|
|
|
window.removeEventListener("tabviewhidden", onTabViewWindowHidden, false);
|
|
|
|
gBrowser.tabContainer.removeEventListener("TabMove", onTabMove, false);
|
|
|
|
|
|
|
|
is(moves, 1, "Only one move should be necessary for this basic move.");
|
|
|
|
|
2011-01-26 13:38:00 -08:00
|
|
|
is(newTabs[2]._tPos, 0, "License is in position 0");
|
2011-01-21 22:25:12 -08:00
|
|
|
is(originalTab._tPos, 1, "Original tab is in position 1");
|
|
|
|
is(newTabs[0]._tPos, 2, "Robots is in position 2");
|
|
|
|
is(newTabs[1]._tPos, 3, "Mozilla is in position 3");
|
2010-11-26 09:50:39 -08:00
|
|
|
|
|
|
|
gBrowser.removeTab(newTabs[0]);
|
|
|
|
gBrowser.removeTab(newTabs[1]);
|
|
|
|
gBrowser.removeTab(newTabs[2]);
|
|
|
|
finish();
|
|
|
|
}
|