@jskit-ai/users-web 0.2.105 → 0.2.107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/fixtures/account-settings/main.js +4 -1
- package/locales/en.json +12 -1
- package/package.json +5 -5
- package/patterns/account-settings/PATTERN.md +62 -10
- package/patterns/account-settings/example/src/components/account/settings/AccountSettingsNotificationsSection.vue +25 -12
- package/patterns/account-settings/example/src/components/account/settings/AccountSettingsPreferencesSection.vue +25 -19
- package/patterns/account-settings/example/src/components/account/settings/AccountSettingsProfileSection.vue +74 -54
- package/patterns/account-settings/example/src/components/account/settings/AccountSettingsSignInMethodsSection.vue +7 -2
- package/src/client/account-settings/sections.js +39 -0
- package/src/client/components/AccountSettingsClientElement.vue +248 -30
- package/src/client/composables/useAccountSettingsRuntime.js +30 -5
- package/test/accountSettings.browser.test.js +462 -28
- package/test/accountSettingsSections.test.js +57 -0
- package/test/settingsPlacementContract.test.js +4 -2
|
@@ -3,6 +3,7 @@ import process from "node:process";
|
|
|
3
3
|
import { after, before, test } from "node:test";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import { chromium, expect } from "@playwright/test";
|
|
6
|
+
import { materialSymbols } from "@jskit-ai/material-web/client/symbols";
|
|
6
7
|
import { createChromiumLaunchOptions, startViteFixture, stopProcess } from "../../../tooling/testUtils/browserFixture.mjs";
|
|
7
8
|
|
|
8
9
|
const RUN = process.env.JSKIT_USERS_WEB_BROWSER_INTEGRATION === "1";
|
|
@@ -108,6 +109,24 @@ async function idleSecond(page) {
|
|
|
108
109
|
return { updates: end.updates - start.updates, busy: end.cpu - start.cpu };
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
// A section's Save: the app bar's primary action, as Material 3 puts a form's Save, named for what it saves.
|
|
113
|
+
function barSave(page, name) {
|
|
114
|
+
return page.getByTestId("jskit-shell-page-actions").getByRole("button", { name, exact: true });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// The question leaving a form with unsaved edits asks.
|
|
118
|
+
function discardQuestion(page) {
|
|
119
|
+
return page.getByRole("alertdialog", { name: "Discard unsaved changes?" });
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Picks an option of a select field, as a person does: open its menu, then choose.
|
|
123
|
+
async function choose(page, label, option) {
|
|
124
|
+
await page.locator(".v-select").filter({ has: page.getByLabel(label, { exact: true }) }).locator(".v-field").click();
|
|
125
|
+
const menu = page.getByRole("listbox");
|
|
126
|
+
await menu.getByRole("option", { name: option, exact: true }).click();
|
|
127
|
+
await expect(menu).toBeHidden();
|
|
128
|
+
}
|
|
129
|
+
|
|
111
130
|
function lastReport(page) {
|
|
112
131
|
return page.evaluate(() => window.accountFixture.reports.at(-1)?.message);
|
|
113
132
|
}
|
|
@@ -135,14 +154,15 @@ test("the profile section loads, saves, shows a refused field and removes the av
|
|
|
135
154
|
await page.goto("/account/profile?returnTo=/home");
|
|
136
155
|
const name = page.getByLabel("Display name");
|
|
137
156
|
await expect(name).toHaveValue("Ada");
|
|
138
|
-
await expect(page.
|
|
157
|
+
await expect(page.getByTestId("account-email")).toContainText("ada@example.com");
|
|
158
|
+
await expect(page.getByRole("textbox", { name: "Email" })).toHaveCount(0);
|
|
139
159
|
await expect(page.getByRole("link", { name: "Done" })).toHaveAttribute("href", "/home");
|
|
140
160
|
await expect(page.getByTestId("jskit-shell-back")).toHaveCount(0);
|
|
141
161
|
// The app bar's title is the page's one h1.
|
|
142
162
|
await expect(page.getByRole("heading", { level: 1 })).toHaveText("Account settings");
|
|
143
163
|
|
|
144
164
|
await name.fill(" Ada Lovelace ");
|
|
145
|
-
await page
|
|
165
|
+
await barSave(page, "Save profile").click();
|
|
146
166
|
await expect.poll(() => lastReport(page)).toBe("Profile updated.");
|
|
147
167
|
await expect(name).toHaveValue("Ada Lovelace");
|
|
148
168
|
const saved = api.requests.find((request) => request.key === "PATCH /api/settings/profile");
|
|
@@ -150,7 +170,7 @@ test("the profile section loads, saves, shows a refused field and removes the av
|
|
|
150
170
|
assert.equal(saved.body.data.type, "user-profiles");
|
|
151
171
|
|
|
152
172
|
await name.fill("Taken");
|
|
153
|
-
await page
|
|
173
|
+
await barSave(page, "Save profile").click();
|
|
154
174
|
await expect(page.getByText("Name is taken.")).toBeVisible();
|
|
155
175
|
// A new error array on every render keeps Vuetify's form updating past Vue's limit, which shows here as a page error.
|
|
156
176
|
assert.deepEqual(api.errors, []);
|
|
@@ -159,14 +179,17 @@ test("the profile section loads, saves, shows a refused field and removes the av
|
|
|
159
179
|
await expect(page.getByRole("button", { name: "Remove avatar" })).toHaveCount(0);
|
|
160
180
|
await expect.poll(() => lastReport(page)).toBe("Avatar removed.");
|
|
161
181
|
|
|
182
|
+
// Done with the refused name still unsaved asks first; discarding it leaves.
|
|
162
183
|
await page.getByRole("link", { name: "Done" }).click();
|
|
184
|
+
await discardQuestion(page).getByRole("button", { name: "Discard" }).click();
|
|
163
185
|
await expect(page.getByTestId("home")).toBeVisible();
|
|
164
186
|
|
|
165
|
-
//
|
|
187
|
+
// On a wide window the list's own page shows the first section beside the list, as that section's page does, and
|
|
188
|
+
// its bar is the same: no Up, and Done returns to returnTo.
|
|
166
189
|
await page.goto("/account?returnTo=/home");
|
|
167
190
|
await expect(page.getByLabel("Display name")).toHaveValue("Ada");
|
|
168
|
-
await expect(page.getByTestId("jskit-shell-back")).
|
|
169
|
-
await expect(page.getByRole("link", { name: "Done" })).
|
|
191
|
+
await expect(page.getByTestId("jskit-shell-back")).toHaveCount(0);
|
|
192
|
+
await expect(page.getByRole("link", { name: "Done" })).toHaveAttribute("href", "/home");
|
|
170
193
|
await finish(api);
|
|
171
194
|
});
|
|
172
195
|
|
|
@@ -186,14 +209,15 @@ test("settings read again keep an unsaved display name, take the rest, and say w
|
|
|
186
209
|
const { page } = api;
|
|
187
210
|
await page.goto("/account/profile");
|
|
188
211
|
const name = page.getByLabel("Display name");
|
|
189
|
-
|
|
212
|
+
// The email is a value to read, which the sign-in account manages: the read shows the server's.
|
|
213
|
+
const email = page.getByTestId("account-email");
|
|
190
214
|
await expect(name).toHaveValue("Ada");
|
|
191
215
|
|
|
192
216
|
await name.fill("Ada Lovelace");
|
|
193
217
|
current = settings({ profile: { ...current.profile, displayName: "Countess Ada", email: "countess@example.com" } });
|
|
194
218
|
await page.evaluate(() => window.dispatchEvent(new Event("visibilitychange")));
|
|
195
219
|
|
|
196
|
-
await expect(email).
|
|
220
|
+
await expect(email).toContainText("countess@example.com");
|
|
197
221
|
await expect(name).toHaveValue("Ada Lovelace");
|
|
198
222
|
const notice = page.locator(".account-settings-section").getByRole("status");
|
|
199
223
|
await expect(notice).toContainText("Display name changed to “Countess Ada” while you were editing.");
|
|
@@ -201,7 +225,7 @@ test("settings read again keep an unsaved display name, take the rest, and say w
|
|
|
201
225
|
await expect(notice.getByRole("button")).toHaveCount(0);
|
|
202
226
|
await expect(name).toHaveValue("Ada Lovelace");
|
|
203
227
|
|
|
204
|
-
await page
|
|
228
|
+
await barSave(page, "Save profile").click();
|
|
205
229
|
await expect.poll(() => lastReport(page)).toBe("Profile updated.");
|
|
206
230
|
const saved = api.requests.find((request) => request.key === "PATCH /api/settings/profile");
|
|
207
231
|
assert.deepEqual(saved.body.data.attributes, { displayName: "Ada Lovelace" });
|
|
@@ -209,9 +233,10 @@ test("settings read again keep an unsaved display name, take the rest, and say w
|
|
|
209
233
|
await finish(api);
|
|
210
234
|
});
|
|
211
235
|
|
|
212
|
-
// Material 3's list-detail layout: a phone shows the section list or one section, and
|
|
213
|
-
// the list and from the list to home; a wide window shows the
|
|
214
|
-
|
|
236
|
+
// Material 3's list-detail layout: a phone shows the section list or one section, and the bar's leading button (a
|
|
237
|
+
// form section's close, X) returns from the section to the list and Up from the list to home; a wide window shows the
|
|
238
|
+
// list beside the open section, with no way back to the list in the bar.
|
|
239
|
+
test("a phone shows the section list and one section at a time, and the bar returns to the list", options, async () => {
|
|
215
240
|
const api = await openApp({ viewport: { width: 390, height: 844 } });
|
|
216
241
|
const { page } = api;
|
|
217
242
|
const up = page.getByTestId("jskit-shell-back");
|
|
@@ -223,18 +248,18 @@ test("a phone shows the section list and one section at a time, and Up returns t
|
|
|
223
248
|
|
|
224
249
|
await page.getByRole("link", { name: "Preferences" }).click();
|
|
225
250
|
await page.waitForURL("**/account/preferences");
|
|
226
|
-
await expect(page
|
|
251
|
+
await expect(barSave(page, "Save preferences")).toBeVisible();
|
|
227
252
|
await expect(sectionLinks.first()).toBeHidden();
|
|
228
253
|
await expect(page.getByRole("link", { name: "Done" })).toHaveCount(0);
|
|
229
254
|
|
|
230
255
|
await up.click();
|
|
231
256
|
await page.waitForURL((url) => url.pathname === "/account");
|
|
232
257
|
await expect(sectionLinks.first()).toBeVisible();
|
|
233
|
-
await expect(page
|
|
258
|
+
await expect(barSave(page, "Save preferences")).toHaveCount(0);
|
|
234
259
|
|
|
235
260
|
// A section opened from a pasted link has the list as its parent too.
|
|
236
261
|
await page.goto("/account/notifications");
|
|
237
|
-
await expect(page
|
|
262
|
+
await expect(barSave(page, "Save notifications")).toBeVisible();
|
|
238
263
|
await up.click();
|
|
239
264
|
await page.waitForURL((url) => url.pathname === "/account");
|
|
240
265
|
await up.click();
|
|
@@ -245,15 +270,119 @@ test("a phone shows the section list and one section at a time, and Up returns t
|
|
|
245
270
|
await wide.page.goto("/account");
|
|
246
271
|
await expect(wide.page.getByRole("link", { name: "Preferences" })).toBeVisible();
|
|
247
272
|
await expect(wide.page.getByLabel("Display name")).toBeVisible();
|
|
248
|
-
|
|
273
|
+
// The open row is Profile's: its name is its title, and the line under it its description.
|
|
274
|
+
await expect(wide.page.locator(".settings-section-list__item.v-list-item--active")).toHaveAccessibleName("Profile");
|
|
249
275
|
await wide.page.getByRole("link", { name: "Preferences" }).click();
|
|
250
276
|
await wide.page.waitForURL("**/account/preferences");
|
|
251
277
|
await expect(wide.page.getByRole("link", { name: "Profile" })).toBeVisible();
|
|
252
|
-
await expect(wide.page
|
|
278
|
+
await expect(barSave(wide.page, "Save preferences")).toBeVisible();
|
|
253
279
|
await expect(wide.page.getByTestId("jskit-shell-back")).toHaveCount(0);
|
|
254
280
|
await finish(wide);
|
|
255
281
|
});
|
|
256
282
|
|
|
283
|
+
// A section's form is an edit form: the app bar's Up arrow is its close (X), Cancel, as the guide's forms have; Save
|
|
284
|
+
// says what it saves and stays off until something changes; and leaving unsaved edits (the close, the browser's Back,
|
|
285
|
+
// another section, closing the tab) asks first. A section that is no form keeps the Up arrow.
|
|
286
|
+
test("a section's form closes with the bar's X, saves only a change, and asks before unsaved edits are left", options, async () => {
|
|
287
|
+
const api = await openApp({ viewport: { width: 390, height: 844 } });
|
|
288
|
+
const { page } = api;
|
|
289
|
+
const close = page.getByTestId("jskit-shell-back");
|
|
290
|
+
const question = discardQuestion(page);
|
|
291
|
+
await page.goto("/account");
|
|
292
|
+
await page.getByRole("link", { name: "Profile" }).click();
|
|
293
|
+
await page.waitForURL("**/account/profile");
|
|
294
|
+
const name = page.getByLabel("Display name");
|
|
295
|
+
const save = barSave(page, "Save profile");
|
|
296
|
+
await expect(name).toHaveValue("Ada");
|
|
297
|
+
await expect(close).toHaveAttribute("data-action", "close");
|
|
298
|
+
await expect(close).toHaveAccessibleName("Cancel");
|
|
299
|
+
await expect(save).toBeDisabled();
|
|
300
|
+
await name.fill("Ada L");
|
|
301
|
+
await expect(save).toBeEnabled();
|
|
302
|
+
await name.fill("Ada");
|
|
303
|
+
await expect(save).toBeDisabled();
|
|
304
|
+
|
|
305
|
+
// The close with an edit asks; keeping on editing stays, with the edit.
|
|
306
|
+
await name.fill("Ada L");
|
|
307
|
+
await close.click();
|
|
308
|
+
await expect(question).toBeVisible();
|
|
309
|
+
await expect(question).toContainText("Your changes to Profile will be lost.");
|
|
310
|
+
// The supporting text sits 16dp under the headline, as in a Material 3 dialog. Measured by layout offsets within the
|
|
311
|
+
// card, which the dialog's opening scale does not change, as it does the boxes on screen.
|
|
312
|
+
const textGap = await question.evaluate((dialog) => {
|
|
313
|
+
const title = dialog.querySelector(".v-card-title");
|
|
314
|
+
const text = dialog.querySelector(".v-card-text p");
|
|
315
|
+
const titleBottom = title.offsetTop + title.offsetHeight - Number.parseFloat(window.getComputedStyle(title).paddingBottom);
|
|
316
|
+
let textTop = 0;
|
|
317
|
+
for (let node = text; node && node !== title.offsetParent; node = node.offsetParent) {
|
|
318
|
+
textTop += node.offsetTop;
|
|
319
|
+
}
|
|
320
|
+
return textTop - titleBottom;
|
|
321
|
+
});
|
|
322
|
+
assert.equal(textGap, 16, `the question's text is ${textGap}px under its headline`);
|
|
323
|
+
await question.getByRole("button", { name: "Keep editing" }).click();
|
|
324
|
+
await expect(question).toHaveCount(0);
|
|
325
|
+
await expect(page).toHaveURL(/\/account\/profile$/u);
|
|
326
|
+
await expect(name).toHaveValue("Ada L");
|
|
327
|
+
|
|
328
|
+
// The browser's Back asks too; discarding leaves for the list, and the form has the saved name again.
|
|
329
|
+
await page.goBack();
|
|
330
|
+
await expect(question).toBeVisible();
|
|
331
|
+
await question.getByRole("button", { name: "Discard" }).click();
|
|
332
|
+
await page.waitForURL((url) => url.pathname === "/account");
|
|
333
|
+
await expect(page.locator(".settings-account__name")).toHaveText("Ada");
|
|
334
|
+
await page.getByRole("link", { name: "Profile" }).click();
|
|
335
|
+
await expect(name).toHaveValue("Ada");
|
|
336
|
+
|
|
337
|
+
// With nothing changed the close leaves at once.
|
|
338
|
+
await close.click();
|
|
339
|
+
await page.waitForURL((url) => url.pathname === "/account");
|
|
340
|
+
await expect(question).toHaveCount(0);
|
|
341
|
+
|
|
342
|
+
// Sign-in methods is no form: its way back is the Up arrow.
|
|
343
|
+
await page.getByRole("link", { name: "Sign-in methods" }).click();
|
|
344
|
+
await page.waitForURL("**/account/sign-in-methods");
|
|
345
|
+
await expect(close).toHaveAttribute("data-action", "up");
|
|
346
|
+
await finish(api);
|
|
347
|
+
|
|
348
|
+
// Beside the list, the account's header shows the saved name while the form holds an unsaved one.
|
|
349
|
+
const wide = await openApp();
|
|
350
|
+
await wide.page.goto("/account/profile");
|
|
351
|
+
const account = wide.page.getByTestId("account-settings-account");
|
|
352
|
+
await wide.page.getByLabel("Display name").fill("Grace Hopper");
|
|
353
|
+
await expect(account.locator(".settings-account__name")).toHaveText("Ada");
|
|
354
|
+
await expect(account.locator(".v-avatar")).toHaveText("A");
|
|
355
|
+
await wide.page.getByLabel("Display name").fill("Ada");
|
|
356
|
+
|
|
357
|
+
// Choosing another section asks too, and so does closing the tab.
|
|
358
|
+
await wide.page.goto("/account/notifications");
|
|
359
|
+
const saveNotifications = barSave(wide.page, "Save notifications");
|
|
360
|
+
const accountActivity = wide.page.getByLabel("Account activity alerts");
|
|
361
|
+
await expect(saveNotifications).toBeDisabled();
|
|
362
|
+
await accountActivity.click();
|
|
363
|
+
await expect(saveNotifications).toBeEnabled();
|
|
364
|
+
await wide.page.getByRole("link", { name: "Preferences" }).click();
|
|
365
|
+
const wideQuestion = discardQuestion(wide.page);
|
|
366
|
+
await expect(wideQuestion).toBeVisible();
|
|
367
|
+
await wideQuestion.getByRole("button", { name: "Keep editing" }).click();
|
|
368
|
+
await expect(wide.page).toHaveURL(/\/account\/notifications$/u);
|
|
369
|
+
await expect(accountActivity).toBeChecked();
|
|
370
|
+
|
|
371
|
+
// Closing or reloading the tab: the page has the browser ask (it cancels beforeunload) while a form has unsaved
|
|
372
|
+
// edits, and lets it go once none has. The browser's own question can't show here: headless Chromium 149 closes a
|
|
373
|
+
// page without it, even a bare page whose handler asks as Playwright's own test page does (probed 1 Dec).
|
|
374
|
+
const unloadAsks = () => wide.page.evaluate(() => {
|
|
375
|
+
const event = new Event("beforeunload", { cancelable: true });
|
|
376
|
+
window.dispatchEvent(event);
|
|
377
|
+
return event.defaultPrevented;
|
|
378
|
+
});
|
|
379
|
+
assert.equal(await unloadAsks(), true);
|
|
380
|
+
await accountActivity.click();
|
|
381
|
+
await expect(saveNotifications).toBeDisabled();
|
|
382
|
+
assert.equal(await unloadAsks(), false);
|
|
383
|
+
await finish(wide);
|
|
384
|
+
});
|
|
385
|
+
|
|
257
386
|
test("saved preferences follow into the theme, the stored preference and the account locale", options, async () => {
|
|
258
387
|
const api = await openApp({
|
|
259
388
|
routes: {
|
|
@@ -270,7 +399,8 @@ test("saved preferences follow into the theme, the stored preference and the acc
|
|
|
270
399
|
|
|
271
400
|
await page.getByRole("link", { name: "Preferences" }).click();
|
|
272
401
|
await page.waitForURL("**/account/preferences");
|
|
273
|
-
await page
|
|
402
|
+
await choose(page, "Theme", "Light");
|
|
403
|
+
await barSave(page, "Save preferences").click();
|
|
274
404
|
await expect.poll(() => lastReport(page)).toBe("Preferences updated.");
|
|
275
405
|
const saved = api.requests.find((request) => request.key === "PATCH /api/settings/preferences");
|
|
276
406
|
assert.equal(saved.body.data.type, "user-preferences");
|
|
@@ -292,7 +422,8 @@ test("a refused preference shows its message", options, async () => {
|
|
|
292
422
|
});
|
|
293
423
|
const { page } = api;
|
|
294
424
|
await page.goto("/account/preferences");
|
|
295
|
-
await page
|
|
425
|
+
await choose(page, "Theme", "Light");
|
|
426
|
+
await barSave(page, "Save preferences").click();
|
|
296
427
|
await expect(page.getByText("Theme is not allowed.")).toBeVisible();
|
|
297
428
|
// The old error array looped here for seconds before Vue gave up, so the page must also stay idle.
|
|
298
429
|
const idle = await idleSecond(page);
|
|
@@ -313,10 +444,11 @@ test("notifications save, and sign-in methods link through the provider and unli
|
|
|
313
444
|
});
|
|
314
445
|
const { page } = api;
|
|
315
446
|
await page.goto("/account/notifications");
|
|
316
|
-
await page.
|
|
447
|
+
await page.getByLabel("Account activity alerts").click();
|
|
448
|
+
await barSave(page, "Save notifications").click();
|
|
317
449
|
await expect.poll(() => lastReport(page)).toBe("Notification settings updated.");
|
|
318
450
|
const saved = api.requests.find((request) => request.key === "PATCH /api/settings/notifications");
|
|
319
|
-
assert.deepEqual(saved.body.data.attributes, { productUpdates: true, accountActivity:
|
|
451
|
+
assert.deepEqual(saved.body.data.attributes, { productUpdates: true, accountActivity: true, securityAlerts: true });
|
|
320
452
|
|
|
321
453
|
await page.getByRole("link", { name: "Sign-in methods" }).click();
|
|
322
454
|
await page.getByRole("button", { name: "Unlink" }).click();
|
|
@@ -330,6 +462,298 @@ test("notifications save, and sign-in methods link through the provider and unli
|
|
|
330
462
|
|
|
331
463
|
// Material 3 type and layout: the section list's labels and the buttons are label-large (14px/500), a switch sits
|
|
332
464
|
// after its label at the row's end, and each field has the form's full width, so a long email shows whole.
|
|
465
|
+
// Each section in the list is its title after a tonal icon tile, the placement's icon or users-web's for its own
|
|
466
|
+
// sections, on every window: the list beside the open section on wide windows and the list alone on a phone. The open
|
|
467
|
+
// section's row carries Material 3's active indicator, a secondary-container pill as tall as the row with its label in
|
|
468
|
+
// on-secondary-container, and no other row has one; its label is bold too, so the pill's colour is not its only mark.
|
|
469
|
+
// Every other row's tile is primary-container with its icon in on-primary-container; the open section's tile is filled
|
|
470
|
+
// primary with its icon in on-primary, so it stands out of its pill (the next test measures how far).
|
|
471
|
+
test("the section list heads each section with its icon on a tonal tile, at every width", options, async () => {
|
|
472
|
+
const symbolPath = (alias) => materialSymbols[alias].slice("svg:".length);
|
|
473
|
+
for (const viewport of [{ width: 390, height: 844 }, { width: 1280, height: 900 }]) {
|
|
474
|
+
const at = `${viewport.width}px`;
|
|
475
|
+
const api = await openApp({ viewport });
|
|
476
|
+
const { page } = api;
|
|
477
|
+
await page.goto("/account");
|
|
478
|
+
await expect(page.getByRole("link", { name: "Preferences" }), at).toBeVisible();
|
|
479
|
+
await page.evaluate(() => window.accountFixture.placeSection());
|
|
480
|
+
await expect(page.getByRole("link", { name: "Extra" }), at).toBeVisible();
|
|
481
|
+
const tiles = await page.locator(".settings-section-list__item").evaluateAll((items) => items.map((item) => {
|
|
482
|
+
const tile = item.querySelector(".v-list-item__prepend .v-avatar");
|
|
483
|
+
// A role as the item's theme draws it (these settings choose the dark theme), read from a new element each time:
|
|
484
|
+
// recolouring one element would read its colour transition's start.
|
|
485
|
+
const role = (name) => {
|
|
486
|
+
const probe = item.appendChild(document.createElement("span"));
|
|
487
|
+
probe.style.color = `rgb(var(--v-theme-${name}))`;
|
|
488
|
+
const color = getComputedStyle(probe).color;
|
|
489
|
+
probe.remove();
|
|
490
|
+
return color;
|
|
491
|
+
};
|
|
492
|
+
const active = item.classList.contains("v-list-item--active");
|
|
493
|
+
// The row's own container: Material 3's active indicator is a secondary-container pill, its corners half the
|
|
494
|
+
// row's height, behind a label in on-secondary-container; a row at rest has no container.
|
|
495
|
+
const row = getComputedStyle(item);
|
|
496
|
+
const title = item.querySelector(".v-list-item-title");
|
|
497
|
+
let indicator = row.backgroundColor === "rgba(0, 0, 0, 0)" ? "none" : row.backgroundColor;
|
|
498
|
+
if (row.backgroundColor === role("secondary-container")) {
|
|
499
|
+
const pill = Number.parseFloat(row.borderTopLeftRadius) >= item.getBoundingClientRect().height / 2;
|
|
500
|
+
const label = getComputedStyle(title).color === role("on-secondary-container");
|
|
501
|
+
indicator = `secondary-container${pill ? " pill" : ""}${label ? ", on-secondary-container label" : ""}`;
|
|
502
|
+
}
|
|
503
|
+
return {
|
|
504
|
+
title: title.textContent.trim(),
|
|
505
|
+
summary: item.querySelector(".v-list-item-subtitle")?.textContent.trim() || "",
|
|
506
|
+
chevron: item.querySelectorAll(".v-list-item__append .v-icon").length,
|
|
507
|
+
icon: tile?.querySelector(".v-icon path")?.getAttribute("d") || "",
|
|
508
|
+
// The roles the tile and its icon are drawn in, of the two each may take.
|
|
509
|
+
tile: ["primary", "primary-container"].find((name) => tile && getComputedStyle(tile).backgroundColor === role(name)) || "",
|
|
510
|
+
iconColor: ["on-primary", "on-primary-container"]
|
|
511
|
+
.find((name) => tile && getComputedStyle(tile.querySelector(".v-icon")).color === role(name)) || "",
|
|
512
|
+
weight: getComputedStyle(title).fontWeight,
|
|
513
|
+
indicator,
|
|
514
|
+
active
|
|
515
|
+
};
|
|
516
|
+
}));
|
|
517
|
+
assert.deepEqual(tiles, [
|
|
518
|
+
["Profile", "person", "Name, avatar and email"],
|
|
519
|
+
["Extra", "settings", ""],
|
|
520
|
+
["Preferences", "tune", "Theme, language and formats"],
|
|
521
|
+
["Notifications", "notifications", "Updates and alerts we send you"],
|
|
522
|
+
["Sign-in methods", "key", "Password and linked accounts"]
|
|
523
|
+
].map(([title, alias, summary]) => {
|
|
524
|
+
// A wide window opens the first section beside the list; a phone shows the list alone, each row opening a page.
|
|
525
|
+
const active = viewport.width >= 840 && title === "Profile";
|
|
526
|
+
const chevron = viewport.width >= 840 ? 0 : 1;
|
|
527
|
+
return {
|
|
528
|
+
title,
|
|
529
|
+
summary,
|
|
530
|
+
chevron,
|
|
531
|
+
icon: symbolPath(alias),
|
|
532
|
+
tile: active ? "primary" : "primary-container",
|
|
533
|
+
iconColor: active ? "on-primary" : "on-primary-container",
|
|
534
|
+
weight: active ? "700" : "400",
|
|
535
|
+
indicator: active ? "secondary-container pill, on-secondary-container label" : "none",
|
|
536
|
+
active
|
|
537
|
+
};
|
|
538
|
+
}), at);
|
|
539
|
+
// Material 3's list item: the title in body-large, the summary under it in body-medium, a two-line row 72dp tall.
|
|
540
|
+
const rows = await page.locator(".settings-section-list__item").evaluateAll((items) => items.map((item) => {
|
|
541
|
+
const subtitle = item.querySelector(".v-list-item-subtitle");
|
|
542
|
+
return {
|
|
543
|
+
title: getComputedStyle(item.querySelector(".v-list-item-title")).fontSize,
|
|
544
|
+
summary: subtitle ? getComputedStyle(subtitle).fontSize : "",
|
|
545
|
+
tall: Math.round(item.getBoundingClientRect().height) >= (subtitle ? 72 : 56)
|
|
546
|
+
};
|
|
547
|
+
}));
|
|
548
|
+
assert.deepEqual(rows, tiles.map((tile) => ({ title: "16px", summary: tile.summary ? "14px" : "", tall: true })), at);
|
|
549
|
+
// The tile and the summary are the item's decoration and description: each link's name is its title alone.
|
|
550
|
+
const signInMethods = page.getByRole("link", { name: "Sign-in methods", exact: true });
|
|
551
|
+
await expect(signInMethods, at).toBeVisible();
|
|
552
|
+
await expect(signInMethods, at).toHaveAccessibleDescription("Password and linked accounts");
|
|
553
|
+
await finish(api);
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
// primary-container and secondary-container share a tone (90 in light, 30 in dark), so a tile in one on the other shows
|
|
558
|
+
// only where a seed's hues happen to differ. The open section's tile is primary (tone 40, 80 in dark) on its row's
|
|
559
|
+
// secondary-container pill: at least 3:1 against the pill, as a graphic object needs, and its icon, on-primary, at
|
|
560
|
+
// least 3:1 against the tile, for material-web's default seed and another, in light and dark.
|
|
561
|
+
test("the open section's tile stands out of its row's active indicator for any seed, in light and dark", options, async (t) => {
|
|
562
|
+
for (const seed of ["", "#006A6A"]) {
|
|
563
|
+
for (const theme of ["light", "dark"]) {
|
|
564
|
+
const at = `${seed || "default seed"}, ${theme}`;
|
|
565
|
+
const api = await openApp({
|
|
566
|
+
routes: { "GET /api/settings": document(settings({ preferences: { ...settings().preferences, theme } })) }
|
|
567
|
+
});
|
|
568
|
+
const { page } = api;
|
|
569
|
+
await page.goto(seed ? `/account?seed=${encodeURIComponent(seed)}` : "/account");
|
|
570
|
+
// The account's saved theme preference decides the scheme.
|
|
571
|
+
await expect(page.locator(`.v-application.v-theme--${theme}`), at).toHaveCount(1);
|
|
572
|
+
const open = page.locator(".settings-section-list__item.v-list-item--active");
|
|
573
|
+
await expect(open, at).toHaveAccessibleName("Profile");
|
|
574
|
+
const measure = () => open.evaluate((item) => {
|
|
575
|
+
const role = (name) => {
|
|
576
|
+
const probe = item.appendChild(document.createElement("span"));
|
|
577
|
+
probe.style.color = `rgb(var(--v-theme-${name}))`;
|
|
578
|
+
const color = getComputedStyle(probe).color;
|
|
579
|
+
probe.remove();
|
|
580
|
+
return color;
|
|
581
|
+
};
|
|
582
|
+
// WCAG's relative luminance and contrast ratio of two opaque colours.
|
|
583
|
+
const luminance = (color) => {
|
|
584
|
+
const [red, green, blue] = color.match(/[\d.]+/gu).slice(0, 3).map((channel) => {
|
|
585
|
+
const value = Number(channel) / 255;
|
|
586
|
+
return value <= 0.04045 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4;
|
|
587
|
+
});
|
|
588
|
+
return 0.2126 * red + 0.7152 * green + 0.0722 * blue;
|
|
589
|
+
};
|
|
590
|
+
const contrast = (one, two) => {
|
|
591
|
+
const [light, dark] = [luminance(one), luminance(two)].sort((a, b) => b - a);
|
|
592
|
+
return (light + 0.05) / (dark + 0.05);
|
|
593
|
+
};
|
|
594
|
+
const tile = item.querySelector(".v-list-item__prepend .v-avatar");
|
|
595
|
+
const pill = getComputedStyle(item).backgroundColor;
|
|
596
|
+
const fill = getComputedStyle(tile).backgroundColor;
|
|
597
|
+
const icon = getComputedStyle(tile.querySelector(".v-icon")).color;
|
|
598
|
+
const tileOnPill = contrast(fill, pill);
|
|
599
|
+
const iconOnTile = contrast(icon, fill);
|
|
600
|
+
return {
|
|
601
|
+
pill: pill === role("secondary-container"),
|
|
602
|
+
tile: fill === role("primary"),
|
|
603
|
+
icon: icon === role("on-primary"),
|
|
604
|
+
tileStandsOut: tileOnPill >= 3,
|
|
605
|
+
iconStandsOut: iconOnTile >= 3,
|
|
606
|
+
// The ratios themselves, which a failure shows.
|
|
607
|
+
ratios: `tile ${tileOnPill.toFixed(2)}:1 on its pill, icon ${iconOnTile.toFixed(2)}:1 on its tile`
|
|
608
|
+
};
|
|
609
|
+
});
|
|
610
|
+
// Read until the scheme has settled (a tile's colour moves with the theme), then judge.
|
|
611
|
+
await expect.poll(measure, { message: at }).toMatchObject({
|
|
612
|
+
pill: true,
|
|
613
|
+
tile: true,
|
|
614
|
+
icon: true,
|
|
615
|
+
tileStandsOut: true,
|
|
616
|
+
iconStandsOut: true
|
|
617
|
+
});
|
|
618
|
+
t.diagnostic(`${at}: ${(await measure()).ratios}`);
|
|
619
|
+
await finish(api);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
// The page says whose account it is: the list is headed by the account's avatar, in a container colour, its name and
|
|
625
|
+
// its email, with no line of copy above it. The profile section's avatar takes the same colour, its fields their
|
|
626
|
+
// leading icons, and the email, which the sign-in account manages, is a detail row to read; no developer caption shows.
|
|
627
|
+
test("the section list is headed by the account, and the profile section's avatar and fields carry their colour and icons", options, async () => {
|
|
628
|
+
const symbolPath = (alias) => materialSymbols[alias].slice("svg:".length);
|
|
629
|
+
for (const viewport of [{ width: 390, height: 844 }, { width: 1280, height: 900 }]) {
|
|
630
|
+
const at = `${viewport.width}px`;
|
|
631
|
+
const api = await openApp({ viewport });
|
|
632
|
+
const { page } = api;
|
|
633
|
+
await page.goto("/account");
|
|
634
|
+
const account = page.getByTestId("account-settings-account");
|
|
635
|
+
await expect(account, at).toContainText("Ada");
|
|
636
|
+
await expect(account, at).toContainText("ada@example.com");
|
|
637
|
+
const header = await account.evaluate((element) => {
|
|
638
|
+
const role = (name) => {
|
|
639
|
+
const probe = element.appendChild(document.createElement("span"));
|
|
640
|
+
probe.style.color = `rgb(var(--v-theme-${name}))`;
|
|
641
|
+
const color = getComputedStyle(probe).color;
|
|
642
|
+
probe.remove();
|
|
643
|
+
return color;
|
|
644
|
+
};
|
|
645
|
+
const list = document.querySelector(".settings-section-list").getBoundingClientRect();
|
|
646
|
+
const tile = document.querySelector(".settings-section-list__item .v-list-item__prepend .v-avatar").getBoundingClientRect();
|
|
647
|
+
const rowTitle = document.querySelector(".settings-section-list__item .v-list-item-title").getBoundingClientRect();
|
|
648
|
+
const avatar = element.querySelector(".v-avatar").getBoundingClientRect();
|
|
649
|
+
return {
|
|
650
|
+
avatar: getComputedStyle(element.querySelector(".v-avatar")).backgroundColor === role("primary-container"),
|
|
651
|
+
initials: element.querySelector(".v-avatar").textContent.trim(),
|
|
652
|
+
above: element.getBoundingClientRect().bottom <= list.top + 1,
|
|
653
|
+
nameSize: getComputedStyle(element.querySelector(".settings-account__name")).fontSize,
|
|
654
|
+
// The avatar is a tile's size, and the name and email start where the rows' titles do.
|
|
655
|
+
avatarSize: Math.round(avatar.width),
|
|
656
|
+
lined: Math.round(avatar.left) === Math.round(tile.left),
|
|
657
|
+
textLined: Math.round(element.querySelector(".settings-account__name").getBoundingClientRect().left) === Math.round(rowTitle.left),
|
|
658
|
+
tileLeft: Math.round(tile.left)
|
|
659
|
+
};
|
|
660
|
+
});
|
|
661
|
+
assert.deepEqual(header, {
|
|
662
|
+
avatar: true,
|
|
663
|
+
initials: "A",
|
|
664
|
+
above: true,
|
|
665
|
+
nameSize: "24px",
|
|
666
|
+
avatarSize: 40,
|
|
667
|
+
lined: true,
|
|
668
|
+
textLined: true,
|
|
669
|
+
tileLeft: viewport.width < 600 ? 16 : header.tileLeft
|
|
670
|
+
}, at);
|
|
671
|
+
await expect(page.getByText("Global profile, preferences, notifications, and account controls."), at).toHaveCount(0);
|
|
672
|
+
await finish(api);
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
for (const viewport of [{ width: 390, height: 844 }, { width: 768, height: 1024 }, { width: 1280, height: 900 }]) {
|
|
676
|
+
const at = `${viewport.width}px`;
|
|
677
|
+
const api = await openApp({ viewport });
|
|
678
|
+
const { page } = api;
|
|
679
|
+
await page.goto("/account/profile");
|
|
680
|
+
await expect(page.getByLabel("Display name", { exact: true }), at).toHaveValue("Ada");
|
|
681
|
+
const detail = page.locator(".settings-section-detail");
|
|
682
|
+
// One pane (a phone or a tablet): the bar's title says where the person is, "Profile", with Up to the list, and
|
|
683
|
+
// the section adds no heading of its own. Beside the list, the bar says "Account settings" and the open section is
|
|
684
|
+
// headed by its tile and title.
|
|
685
|
+
const twoPane = viewport.width >= 840;
|
|
686
|
+
await expect(page.getByRole("heading", { level: 1 }), at).toHaveText(twoPane ? "Account settings" : "Profile");
|
|
687
|
+
await expect(detail.getByRole("heading", { level: 2, name: "Profile" }), at).toHaveCount(twoPane ? 1 : 0);
|
|
688
|
+
const profile = await detail.evaluate((section, twoPane) => {
|
|
689
|
+
const role = (name) => {
|
|
690
|
+
const probe = section.appendChild(document.createElement("span"));
|
|
691
|
+
probe.style.color = `rgb(var(--v-theme-${name}))`;
|
|
692
|
+
const color = getComputedStyle(probe).color;
|
|
693
|
+
probe.remove();
|
|
694
|
+
return color;
|
|
695
|
+
};
|
|
696
|
+
const heading = section.querySelector("[data-testid='account-settings-section-heading']");
|
|
697
|
+
const field = [...section.querySelectorAll(".v-input")]
|
|
698
|
+
.find((input) => input.querySelector("label")?.textContent.trim() === "Display name");
|
|
699
|
+
const email = section.querySelector("[data-testid='account-email']");
|
|
700
|
+
const avatarButton = [...section.querySelectorAll("button")].find((button) => button.textContent.trim() === "Change avatar");
|
|
701
|
+
const fieldBox = field.querySelector(".v-field").getBoundingClientRect();
|
|
702
|
+
const fieldIcon = field.querySelector(".v-field__prepend-inner .v-icon").getBoundingClientRect();
|
|
703
|
+
const input = field.querySelector("input");
|
|
704
|
+
const inputText = input.getBoundingClientRect().left + Number.parseFloat(getComputedStyle(input).paddingInlineStart);
|
|
705
|
+
const lines = [...email.querySelectorAll(".account-email__text > *")];
|
|
706
|
+
const accountAvatar = document.querySelector("[data-testid='account-settings-account'] .v-avatar")?.getBoundingClientRect();
|
|
707
|
+
const listLeft = document.querySelector(".settings-section-list")?.getBoundingClientRect().left;
|
|
708
|
+
return {
|
|
709
|
+
headingTile: heading ? getComputedStyle(heading.querySelector(".v-avatar")).backgroundColor === role("primary-container") : null,
|
|
710
|
+
avatar:
|
|
711
|
+
getComputedStyle(section.querySelector(".account-settings-section .v-avatar")).backgroundColor === role("primary-container"),
|
|
712
|
+
avatarButton: Boolean(avatarButton) && getComputedStyle(avatarButton).backgroundColor === role("secondary-container"),
|
|
713
|
+
displayName: field?.querySelector(".v-field__prepend-inner .v-icon path")?.getAttribute("d") || "",
|
|
714
|
+
fieldHeight: Math.round(fieldBox.height),
|
|
715
|
+
email: email?.querySelector(".v-icon path")?.getAttribute("d") || "",
|
|
716
|
+
// A detail row: its value is its title, in body-large; "Email" and who manages it are its quieter lines.
|
|
717
|
+
emailLines: lines.map((line) => [line.textContent.trim(), getComputedStyle(line).fontSize]),
|
|
718
|
+
// The row's icon and text on the field's keylines above it.
|
|
719
|
+
emailLined: [
|
|
720
|
+
Math.round(email.querySelector(".v-icon").getBoundingClientRect().left - fieldIcon.left),
|
|
721
|
+
Math.round(lines[0].getBoundingClientRect().left - inputText)
|
|
722
|
+
],
|
|
723
|
+
fieldGap: Math.round(email.getBoundingClientRect().top - field.getBoundingClientRect().bottom),
|
|
724
|
+
// One pane: the form starts at the window's margin, no padding of its own on top of it. Beside the list: the
|
|
725
|
+
// open section's top lines up with the account's, its right margin is the list's left one, and its form keeps a
|
|
726
|
+
// readable width.
|
|
727
|
+
start: twoPane ? null : Math.round(fieldBox.left),
|
|
728
|
+
topsLined: heading && accountAvatar ? Math.round(heading.querySelector(".v-avatar").getBoundingClientRect().top) === Math.round(accountAvatar.top) : null,
|
|
729
|
+
margins: heading ? Math.round(window.innerWidth - section.getBoundingClientRect().right) === Math.round(listLeft) : null,
|
|
730
|
+
formWidth: heading ? Math.round(fieldBox.width) <= 600 : null
|
|
731
|
+
};
|
|
732
|
+
}, twoPane);
|
|
733
|
+
assert.ok(profile.fieldGap >= 0 && profile.fieldGap <= 8, `${at}: only the message line under Display name: ${profile.fieldGap}px`);
|
|
734
|
+
delete profile.fieldGap;
|
|
735
|
+
assert.deepEqual(profile, {
|
|
736
|
+
headingTile: twoPane ? true : null,
|
|
737
|
+
avatar: true,
|
|
738
|
+
avatarButton: true,
|
|
739
|
+
displayName: symbolPath("person"),
|
|
740
|
+
fieldHeight: 56,
|
|
741
|
+
email: symbolPath("mail"),
|
|
742
|
+
emailLines: [["ada@example.com", "16px"], ["Email", "14px"], ["Managed by your sign-in account", "14px"]],
|
|
743
|
+
emailLined: [0, 0],
|
|
744
|
+
start: twoPane ? null : viewport.width < 600 ? 16 : 24,
|
|
745
|
+
topsLined: twoPane ? true : null,
|
|
746
|
+
margins: twoPane ? true : null,
|
|
747
|
+
formWidth: twoPane ? true : null
|
|
748
|
+
}, at);
|
|
749
|
+
await expect(page.getByRole("textbox", { name: "Email" }), at).toHaveCount(0);
|
|
750
|
+
await expect(page.getByText(/Preview size/u), at).toHaveCount(0);
|
|
751
|
+
await expect(barSave(page, "Save profile"), at).toBeVisible();
|
|
752
|
+
await expect(detail.getByRole("button", { name: /Save/u }), at).toHaveCount(0);
|
|
753
|
+
await finish(api);
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
|
|
333
757
|
test("account settings use Material 3 label type, trailing switches and full-width fields", options, async () => {
|
|
334
758
|
const email = "ada.lovelace.analytical.engine@difference-engine.example.com";
|
|
335
759
|
const api = await openApp({
|
|
@@ -337,13 +761,17 @@ test("account settings use Material 3 label type, trailing switches and full-wid
|
|
|
337
761
|
});
|
|
338
762
|
const { page } = api;
|
|
339
763
|
await page.goto("/account");
|
|
340
|
-
|
|
764
|
+
const shownEmail = page.getByTestId("account-email").getByText(email);
|
|
765
|
+
await expect(shownEmail).toBeVisible();
|
|
766
|
+
assert.equal(await shownEmail.evaluate((element) => element.scrollWidth <= element.clientWidth), true, "the email shows whole");
|
|
341
767
|
const type = (locator) => locator.evaluate((element) => {
|
|
342
768
|
const style = window.getComputedStyle(element);
|
|
343
769
|
return [style.fontSize, style.fontWeight];
|
|
344
770
|
});
|
|
345
|
-
|
|
346
|
-
|
|
771
|
+
const label = page.locator(".settings-section-list__item:not(.v-list-item--active) .v-list-item-title").first();
|
|
772
|
+
// A row's title is a list item's body-large (its summary body-medium); the bar's Save is a button's label-large.
|
|
773
|
+
assert.deepEqual(await type(label), ["16px", "400"]);
|
|
774
|
+
assert.deepEqual(await type(barSave(page, "Save profile")), ["14px", "500"]);
|
|
347
775
|
const fields = await page.evaluate(() => {
|
|
348
776
|
const form = document.querySelector(".settings-section-detail form");
|
|
349
777
|
const width = (element) => Math.round(element.getBoundingClientRect().width);
|
|
@@ -352,7 +780,7 @@ test("account settings use Material 3 label type, trailing switches and full-wid
|
|
|
352
780
|
return { width: width(field), form: width(form), whole: input.scrollWidth <= input.clientWidth };
|
|
353
781
|
});
|
|
354
782
|
});
|
|
355
|
-
assert.ok(fields.length >=
|
|
783
|
+
assert.ok(fields.length >= 1, "the profile form has its fields");
|
|
356
784
|
for (const field of fields) {
|
|
357
785
|
assert.ok(field.width >= field.form - 48, `a field has the form's width: ${JSON.stringify(field)}`);
|
|
358
786
|
assert.equal(field.whole, true, `a field shows its value whole: ${JSON.stringify(field)}`);
|
|
@@ -390,9 +818,10 @@ test("each section stays busy until its save or removal answers", options, async
|
|
|
390
818
|
|
|
391
819
|
await page.goto("/account");
|
|
392
820
|
const name = page.getByLabel("Display name");
|
|
393
|
-
const saveProfile = page
|
|
821
|
+
const saveProfile = barSave(page, "Save profile");
|
|
394
822
|
const removeAvatar = page.getByRole("button", { name: "Remove avatar" });
|
|
395
823
|
await expect(name).toHaveValue("Ada");
|
|
824
|
+
await name.fill("Ada L");
|
|
396
825
|
await saveProfile.click();
|
|
397
826
|
await expect(saveProfile).toHaveClass(loading);
|
|
398
827
|
await expect(name).not.toBeEditable();
|
|
@@ -401,16 +830,20 @@ test("each section stays busy until its save or removal answers", options, async
|
|
|
401
830
|
await expect(saveProfile).not.toHaveClass(loading);
|
|
402
831
|
await expect(name).toBeEditable();
|
|
403
832
|
|
|
833
|
+
// An unsaved name waits for the avatar's removal to save.
|
|
834
|
+
await name.fill("Ada L");
|
|
404
835
|
await removeAvatar.click();
|
|
405
836
|
await expect(removeAvatar).toHaveClass(loading);
|
|
406
837
|
await expect(saveProfile).toBeDisabled();
|
|
407
838
|
answers.avatar.resolve(document(settings()));
|
|
408
839
|
await expect(removeAvatar).not.toHaveClass(loading);
|
|
409
840
|
await expect(saveProfile).toBeEnabled();
|
|
841
|
+
await name.fill("Ada");
|
|
410
842
|
|
|
411
843
|
await page.getByRole("link", { name: "Preferences" }).click();
|
|
412
|
-
const savePreferences = page
|
|
844
|
+
const savePreferences = barSave(page, "Save preferences");
|
|
413
845
|
const disabledFields = page.locator(".v-input--disabled");
|
|
846
|
+
await choose(page, "Theme", "Light");
|
|
414
847
|
await savePreferences.click();
|
|
415
848
|
await expect(savePreferences).toHaveClass(loading);
|
|
416
849
|
await expect(disabledFields).not.toHaveCount(0);
|
|
@@ -419,8 +852,9 @@ test("each section stays busy until its save or removal answers", options, async
|
|
|
419
852
|
await expect(disabledFields).toHaveCount(0);
|
|
420
853
|
|
|
421
854
|
await page.getByRole("link", { name: "Notifications" }).click();
|
|
422
|
-
const saveNotifications = page
|
|
855
|
+
const saveNotifications = barSave(page, "Save notifications");
|
|
423
856
|
const productUpdates = page.getByLabel("Product updates");
|
|
857
|
+
await page.getByLabel("Account activity alerts").click();
|
|
424
858
|
await saveNotifications.click();
|
|
425
859
|
await expect(saveNotifications).toHaveClass(loading);
|
|
426
860
|
await expect(productUpdates).toBeDisabled();
|