Bug 1805391 - Ensure support links get their hrefs populated. r=sclements

Differential Revision: https://phabricator.services.mozilla.com/D164926
This commit is contained in:
Sam Foster 2022-12-19 10:42:57 +00:00
Родитель bff0c42c1c
Коммит 219303ec57
2 изменённых файлов: 33 добавлений и 1 удалений

Просмотреть файл

@ -44,6 +44,12 @@ class TabPickupContainer extends HTMLDetailsElement {
this.addEventListener("visibilitychange", this);
Services.obs.addObserver(this.boundObserve, TOPIC_SETUPSTATE_CHANGED);
for (let elem of this.querySelectorAll("a[data-support-url]")) {
elem.href =
Services.urlFormatter.formatURLPref("app.support.baseURL") +
elem.dataset.supportUrl;
}
// we wait until the list shows up before trying to populate it,
// when its safe to assume the custom-element's methods will be available
this.tabListAdded = this.promiseChildAdded();

Просмотреть файл

@ -143,7 +143,6 @@ add_task(async function test_signed_in() {
await waitForVisibleSetupStep(browser, {
expectedVisible: "#tabpickup-steps-view2",
});
is(
fxAccounts.device.recentDeviceList?.length,
1,
@ -182,6 +181,33 @@ add_task(async function test_signed_in() {
await tearDown(sandbox);
});
add_task(async function test_support_links() {
await clearAllParentTelemetryEvents();
setupMocks({
state: UIState.STATUS_SIGNED_IN,
fxaDevices: [
{
id: 1,
name: "This Device",
isCurrentDevice: true,
type: "desktop",
},
],
});
await withFirefoxView({ win: window }, async browser => {
Services.obs.notifyObservers(null, UIState.ON_UPDATE);
await waitForVisibleSetupStep(browser, {
expectedVisible: "#tabpickup-steps-view2",
});
const { document } = browser.contentWindow;
const container = document.getElementById("tab-pickup-container");
const supportLinks = Array.from(
container.querySelectorAll("a[href]")
).filter(a => !!a.href);
is(supportLinks.length, 2, "Support links have non-empty hrefs");
});
});
add_task(async function test_2nd_desktop_connected() {
const sandbox = setupMocks({
state: UIState.STATUS_SIGNED_IN,