@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
|
@@ -116,3 +116,60 @@ test("normalizeAccountSettingsSectionEntry keeps a message-key title for the hos
|
|
|
116
116
|
null
|
|
117
117
|
);
|
|
118
118
|
});
|
|
119
|
+
|
|
120
|
+
test("each section has its icon: the placement's own, else users-web's for its own sections, else a settings icon", () => {
|
|
121
|
+
const section = (value, icon) => ({ component: {}, props: { value, title: value, ...(icon === undefined ? {} : { icon }) } });
|
|
122
|
+
const resolved = resolveAccountSettingsSections([
|
|
123
|
+
section("profile"),
|
|
124
|
+
section("preferences"),
|
|
125
|
+
section("notifications"),
|
|
126
|
+
section("sign-in-methods"),
|
|
127
|
+
section("billing"),
|
|
128
|
+
section("invites", "$mail"),
|
|
129
|
+
section("security", " $lock ")
|
|
130
|
+
]);
|
|
131
|
+
assert.deepEqual(Object.fromEntries(resolved.map((entry) => [entry.value, entry.icon])), {
|
|
132
|
+
profile: "$person",
|
|
133
|
+
preferences: "$tune",
|
|
134
|
+
notifications: "$notifications",
|
|
135
|
+
"sign-in-methods": "$key",
|
|
136
|
+
billing: "$settings",
|
|
137
|
+
invites: "$mail",
|
|
138
|
+
security: "$lock"
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test("a placement's own icon wins over users-web's for its own section", () => {
|
|
143
|
+
const entry = normalizeAccountSettingsSectionEntry({
|
|
144
|
+
component: {},
|
|
145
|
+
props: { value: "profile", title: "Profile", icon: "$accountCircle" }
|
|
146
|
+
});
|
|
147
|
+
assert.equal(entry.icon, "$accountCircle");
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// A section's line under its title in the list says what it holds: the placement's own (plain text, a message key or
|
|
151
|
+
// { key, fallback }), else users-web's for its own sections, else none.
|
|
152
|
+
test("each section has its one-line summary: the placement's own, else users-web's for its own sections, else none", () => {
|
|
153
|
+
const section = (value, summary) => ({
|
|
154
|
+
component: {},
|
|
155
|
+
props: { value, title: value, ...(summary === undefined ? {} : { summary }) }
|
|
156
|
+
});
|
|
157
|
+
const resolved = resolveAccountSettingsSections([
|
|
158
|
+
section("profile"),
|
|
159
|
+
section("preferences"),
|
|
160
|
+
section("notifications"),
|
|
161
|
+
section("sign-in-methods"),
|
|
162
|
+
section("billing"),
|
|
163
|
+
section("invites", " People you invited "),
|
|
164
|
+
section("security", { key: "app.settings.security.summary", fallback: "Two-step sign-in" })
|
|
165
|
+
]);
|
|
166
|
+
assert.deepEqual(Object.fromEntries(resolved.map((entry) => [entry.value, entry.summary])), {
|
|
167
|
+
profile: "jskit.users.accountSettings.summary.profile",
|
|
168
|
+
preferences: "jskit.users.accountSettings.summary.preferences",
|
|
169
|
+
notifications: "jskit.users.accountSettings.summary.notifications",
|
|
170
|
+
"sign-in-methods": "jskit.users.accountSettings.summary.signInMethods",
|
|
171
|
+
billing: "",
|
|
172
|
+
invites: "People you invited",
|
|
173
|
+
security: { key: "app.settings.security.summary", fallback: "Two-step sign-in" }
|
|
174
|
+
});
|
|
175
|
+
});
|
|
@@ -90,10 +90,12 @@ test("package-owned account settings host is placement-backed rather than scaffo
|
|
|
90
90
|
);
|
|
91
91
|
|
|
92
92
|
assert.match(source, /useAccountSettingsSections/);
|
|
93
|
-
// The app bar carries the title, and Done only where Up can't go back; the
|
|
93
|
+
// The app bar carries the title, and Done only where Up can't go back; the list is headed by the account, with no
|
|
94
|
+
// line of copy above it.
|
|
94
95
|
assert.match(source, /<ShellPageActions v-if="showsDone">/u);
|
|
95
96
|
assert.match(source, /const showsDone = computed\(\(\) => !canGoUp\.value \|\| !doneTarget\.value\.sameOrigin\);/u);
|
|
96
|
-
assert.match(source, /settings-
|
|
97
|
+
assert.match(source, /data-testid="account-settings-account"/);
|
|
98
|
+
assert.doesNotMatch(source, /settings-panel__intro/);
|
|
97
99
|
assert.match(source, /useShellPageTitle/);
|
|
98
100
|
assert.doesNotMatch(source, /<h1/u);
|
|
99
101
|
assert.doesNotMatch(source, /AccountSettingsProfileSection|AccountSettingsPreferencesSection|AccountSettingsNotificationsSection/);
|