зеркало из https://github.com/mozilla/gecko-dev.git
Bug 623911 - First tab in stack changes when expand button is opened and then closed [r=ian, a=dietrich]
This commit is contained in:
Родитель
b4194883cc
Коммит
806a9dad07
|
@ -1344,7 +1344,6 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
// dropIndex - (int) the index at which a dragged item (if there is one) should be added
|
||||
// if it is dropped. Otherwise (boolean) false.
|
||||
_gridArrange: function GroupItem__gridArrange(childrenToArrange, box, options) {
|
||||
this.topChild = null;
|
||||
let arrangeOptions;
|
||||
if (this.expanded) {
|
||||
// if we're expanded, we actually want to use the expanded tray's bounds.
|
||||
|
@ -1352,6 +1351,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
|||
box.inset(8, 8);
|
||||
arrangeOptions = Utils.extend({}, options, {z: 99999});
|
||||
} else {
|
||||
this.topChild = null;
|
||||
this._isStacked = false;
|
||||
arrangeOptions = Utils.extend({}, options, {
|
||||
columns: this._columns
|
||||
|
|
|
@ -134,13 +134,13 @@ function onTabViewWindowLoaded(win) {
|
|||
|
||||
win.addEventListener("tabviewhidden", stage2hidden, false);
|
||||
// again, null type means "click", for some reason...
|
||||
EventUtils.synthesizeMouse(children[0].container, 2, 2, {type: null}, contentWindow);
|
||||
EventUtils.synthesizeMouse(children[1].container, 2, 2, {type: null}, contentWindow);
|
||||
};
|
||||
|
||||
let stage2hidden = function() {
|
||||
win.removeEventListener("tabviewhidden", stage2hidden, false);
|
||||
|
||||
is(win.gBrowser.selectedTab, children[0].tab, "We clicked on the first child.");
|
||||
is(win.gBrowser.selectedTab, children[1].tab, "We clicked on the second child.");
|
||||
|
||||
win.addEventListener("tabviewshown", stage2shown, false);
|
||||
win.TabView.toggle();
|
||||
|
@ -155,21 +155,71 @@ function onTabViewWindowLoaded(win) {
|
|||
let stackCenter = children[0].getBounds().center();
|
||||
ok(stackCenter.y < expanderBounds.center().y, "The expander is below the stack.");
|
||||
|
||||
// In preparation for Stage 3, find that original tab and make it the active tab.
|
||||
let originalTabItem = originalTab._tabViewTabItem;
|
||||
contentWindow.UI.setActiveTab(originalTabItem);
|
||||
|
||||
is(group.topChild, children[1], "The top child in the stack is the second tab item");
|
||||
let topChildzIndex = children[1].zIndex;
|
||||
// the second tab item should have the largest z-index.
|
||||
// only check the first 6 tabs as the stack only contains 6 tab items.
|
||||
for (let i = 0; i < 6; i++) {
|
||||
if (i != 1)
|
||||
ok(children[i].zIndex < topChildzIndex,
|
||||
"The child[" + i + "] has smaller zIndex than second dhild");
|
||||
}
|
||||
|
||||
// okay, expand this group one last time
|
||||
group.addSubscriber("test stage 3", "expanded", stage3expanded);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, expander[0], contentWindow);
|
||||
}
|
||||
|
||||
|
||||
// STAGE 3:
|
||||
// Ensure that stack still shows the same top item after a expand and a collapse.
|
||||
let stage3expanded = function() {
|
||||
group.removeSubscriber("test stage 3", "expanded", stage3expanded);
|
||||
|
||||
ok(group.expanded, "The group is now expanded.");
|
||||
let overlay = contentWindow.document.getElementById("expandedTray");
|
||||
let $overlay = contentWindow.iQ(overlay);
|
||||
|
||||
group.addSubscriber("test stage 3", "collapsed", stage3collapsed);
|
||||
// null type means "click", for some reason...
|
||||
EventUtils.synthesizeMouse(contentWindow.document.body, 10, $overlay.bounds().bottom + 5,
|
||||
{type: null}, contentWindow);
|
||||
};
|
||||
|
||||
let stage3collapsed = function() {
|
||||
group.removeSubscriber("test stage 3", "collapsed", stage3collapsed);
|
||||
|
||||
ok(!group.expanded, "The group is no longer expanded.");
|
||||
isnot(expander[0].style.display, "none", "The expander is visible!");
|
||||
|
||||
let stackCenter = children[0].getBounds().center();
|
||||
ok(stackCenter.y < expanderBounds.center().y, "The expander is below the stack.");
|
||||
|
||||
is(group.topChild, children[1],
|
||||
"The top child in the stack is still the second tab item");
|
||||
let topChildzIndex = children[1].zIndex;
|
||||
// the second tab item should have the largest z-index.
|
||||
// only check the first 6 tabs as the stack only contains 6 tab items.
|
||||
for (let i = 0; i < 6; i++) {
|
||||
if (i != 1)
|
||||
ok(children[i].zIndex < topChildzIndex,
|
||||
"The child[" + i + "] has smaller zIndex than second dhild after a collapse.");
|
||||
}
|
||||
|
||||
// In preparation for Stage 4, find that original tab and make it the active tab.
|
||||
let originalTabItem = originalTab._tabViewTabItem;
|
||||
contentWindow.UI.setActiveTab(originalTabItem);
|
||||
|
||||
// now, try opening it up again.
|
||||
group.addSubscriber("test stage 4", "expanded", stage4expanded);
|
||||
EventUtils.sendMouseEvent({ type: "click" }, expander[0], contentWindow);
|
||||
};
|
||||
|
||||
// STAGE 4:
|
||||
// Activate another tab not in this group, expand our stacked group, but then
|
||||
// enter Panorama (i.e., zoom into this other group), and make sure we can go to
|
||||
// it and that the tray gets collapsed.
|
||||
let stage3expanded = function() {
|
||||
group.removeSubscriber("test stage 3", "expanded", stage3expanded);
|
||||
let stage4expanded = function() {
|
||||
group.removeSubscriber("test stage 4", "expanded", stage4expanded);
|
||||
|
||||
ok(group.expanded, "The group is now expanded.");
|
||||
is(expander[0].style.display, "none", "The expander is hidden!");
|
||||
|
@ -186,12 +236,12 @@ function onTabViewWindowLoaded(win) {
|
|||
ok(someChildIsActive, "Now one of the children in the group is active.");
|
||||
|
||||
// now activate Panorama...
|
||||
win.addEventListener("tabviewhidden", stage3hidden, false);
|
||||
win.addEventListener("tabviewhidden", stage4hidden, false);
|
||||
win.TabView.toggle();
|
||||
};
|
||||
|
||||
let stage3hidden = function() {
|
||||
win.removeEventListener("tabviewhidden", stage3hidden, false);
|
||||
let stage4hidden = function() {
|
||||
win.removeEventListener("tabviewhidden", stage4hidden, false);
|
||||
|
||||
isnot(win.gBrowser.selectedTab, originalTab, "We did not enter the original tab.");
|
||||
|
||||
|
@ -199,12 +249,12 @@ function onTabViewWindowLoaded(win) {
|
|||
child.tab == win.gBrowser.selectedTab);
|
||||
ok(someChildIsSelected, "Instead we're in one of the stack's children.");
|
||||
|
||||
win.addEventListener("tabviewshown", stage3shown, false);
|
||||
win.addEventListener("tabviewshown", stage4shown, false);
|
||||
win.TabView.toggle();
|
||||
};
|
||||
|
||||
let stage3shown = function() {
|
||||
win.removeEventListener("tabviewshown", stage3shown, false);
|
||||
let stage4shown = function() {
|
||||
win.removeEventListener("tabviewshown", stage4shown, false);
|
||||
|
||||
let overlay = contentWindow.document.getElementById("expandedTray");
|
||||
ok(!group.expanded, "The group is no longer expanded.");
|
||||
|
|
Загрузка…
Ссылка в новой задаче