mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
Bug 1105523 - UITour: Provide a way for some Hello targets to have their info panel arrow on the side r=Unfocused
This commit is contained in:
parent
a16cef4d14
commit
85c138330a
@ -121,15 +121,19 @@ this.UITour = {
|
||||
}],
|
||||
["loop", {query: "#loop-button"}],
|
||||
["loop-newRoom", {
|
||||
infoPanelPosition: "leftcenter topright",
|
||||
query: (aDocument) => {
|
||||
let loopBrowser = aDocument.querySelector("#loop-notification-panel > #loop");
|
||||
if (!loopBrowser) {
|
||||
return null;
|
||||
}
|
||||
return loopBrowser.contentDocument.querySelector(".new-room-button");
|
||||
// Use the parentElement full-width container of the button so our arrow
|
||||
// doesn't overlap the panel contents much.
|
||||
return loopBrowser.contentDocument.querySelector(".new-room-button").parentElement;
|
||||
},
|
||||
}],
|
||||
["loop-roomList", {
|
||||
infoPanelPosition: "leftcenter topright",
|
||||
query: (aDocument) => {
|
||||
let loopBrowser = aDocument.querySelector("#loop-notification-panel > #loop");
|
||||
if (!loopBrowser) {
|
||||
@ -150,6 +154,7 @@ this.UITour = {
|
||||
["privateWindow", {query: "#privatebrowsing-button"}],
|
||||
["quit", {query: "#PanelUI-quit"}],
|
||||
["search", {
|
||||
infoPanelPosition: "after_start",
|
||||
query: "#searchbar",
|
||||
widgetName: "search-container",
|
||||
}],
|
||||
@ -877,6 +882,7 @@ this.UITour = {
|
||||
|
||||
deferred.resolve({
|
||||
addTargetListener: targetObject.addTargetListener,
|
||||
infoPanelPosition: targetObject.infoPanelPosition,
|
||||
node: node,
|
||||
removeTargetListener: targetObject.removeTargetListener,
|
||||
targetName: aTargetName,
|
||||
@ -1209,10 +1215,13 @@ this.UITour = {
|
||||
|
||||
tooltip.setAttribute("targetName", aAnchor.targetName);
|
||||
tooltip.hidden = false;
|
||||
let xOffset = 0, yOffset = 0;
|
||||
let alignment = "bottomcenter topright";
|
||||
if (aAnchor.infoPanelPosition) {
|
||||
alignment = aAnchor.infoPanelPosition;
|
||||
}
|
||||
|
||||
let xOffset = 0, yOffset = 0;
|
||||
if (aAnchor.targetName == "search") {
|
||||
alignment = "after_start";
|
||||
xOffset = 18;
|
||||
}
|
||||
this._addAnnotationPanelMutationObserver(tooltip);
|
||||
|
@ -100,8 +100,28 @@ let tests = [
|
||||
});
|
||||
LoopRooms.open("fakeTourRoom");
|
||||
},
|
||||
taskify(function* test_arrow_panel_position() {
|
||||
ise(loopButton.open, false, "Menu should initially be closed");
|
||||
let popup = document.getElementById("UITourTooltip");
|
||||
|
||||
yield showMenuPromise("loop");
|
||||
|
||||
let currentTarget = "loop-newRoom";
|
||||
yield showInfoPromise(currentTarget, "This is " + currentTarget, "My arrow should be on the side");
|
||||
is(popup.popupBoxObject.alignmentPosition, "start_before", "Check " + currentTarget + " position");
|
||||
|
||||
currentTarget = "loop-roomList";
|
||||
yield showInfoPromise(currentTarget, "This is " + currentTarget, "My arrow should be on the side");
|
||||
is(popup.popupBoxObject.alignmentPosition, "start_before", "Check " + currentTarget + " position");
|
||||
|
||||
currentTarget = "loop-signInUpLink";
|
||||
yield showInfoPromise(currentTarget, "This is " + currentTarget, "My arrow should be underneath");
|
||||
is(popup.popupBoxObject.alignmentPosition, "after_end", "Check " + currentTarget + " position");
|
||||
}),
|
||||
];
|
||||
|
||||
// End tests
|
||||
|
||||
function checkLoopPanelIsHidden() {
|
||||
ok(!loopPanel.hasAttribute("noautohide"), "@noautohide on the loop panel should have been cleaned up");
|
||||
ok(!loopPanel.hasAttribute("panelopen"), "The panel shouldn't have @panelopen");
|
||||
|
@ -135,6 +135,12 @@ function showInfoPromise(...args) {
|
||||
return promisePanelElementShown(window, popup);
|
||||
}
|
||||
|
||||
function showMenuPromise(name) {
|
||||
return new Promise(resolve => {
|
||||
gContentAPI.showMenu(name, () => resolve());
|
||||
});
|
||||
}
|
||||
|
||||
function waitForCallbackResultPromise() {
|
||||
return waitForConditionPromise(() => {
|
||||
return gContentWindow.callbackResult;
|
||||
|
Loading…
x
Reference in New Issue
Block a user