@csntgao/uni-base 0.6.0 → 0.6.1
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/package.json
CHANGED
|
@@ -1159,9 +1159,9 @@ export class UniplatAccountContext extends LitElement {
|
|
|
1159
1159
|
@cancel=${this.handleOnboardingCancel}
|
|
1160
1160
|
@onboarding-skipped=${this.handleOnboardingSkipped}
|
|
1161
1161
|
@organization-created=${this.refreshAfterOrganizationCreated}
|
|
1162
|
-
@enterprise-authentication-requested=${this.
|
|
1163
|
-
@enterprise-authentication-deferred=${this.
|
|
1164
|
-
@onboarding-finished=${this.
|
|
1162
|
+
@enterprise-authentication-requested=${this.finishOnboarding}
|
|
1163
|
+
@enterprise-authentication-deferred=${this.finishOnboarding}
|
|
1164
|
+
@onboarding-finished=${this.finishOnboarding}
|
|
1165
1165
|
>
|
|
1166
1166
|
<div class="onboarding-dialog" @click=${stopEventPropagation}>
|
|
1167
1167
|
<uniplat-internal-organization-onboarding></uniplat-internal-organization-onboarding>
|
|
@@ -1335,8 +1335,11 @@ export class UniplatAccountContext extends LitElement {
|
|
|
1335
1335
|
}
|
|
1336
1336
|
|
|
1337
1337
|
// 成功页的认证 / 升级 / 邀请动作是强制入驻的终点,此时才允许关闭对话框。
|
|
1338
|
-
|
|
1339
|
-
|
|
1338
|
+
/**
|
|
1339
|
+
* 创建成功页的动作是入驻流程的终点,强制态与普通态都必须收起对话框:
|
|
1340
|
+
* 普通态没有 mandatoryOnboarding 标记,早退会让"确认"看起来点不动。
|
|
1341
|
+
*/
|
|
1342
|
+
private readonly finishOnboarding = (): void => {
|
|
1340
1343
|
this.mandatoryOnboarding = false
|
|
1341
1344
|
this.activePanel = null
|
|
1342
1345
|
}
|
|
@@ -337,6 +337,42 @@ describe('<uniplat-account-context>', () => {
|
|
|
337
337
|
expect(context.shadowRoot?.querySelector('dialog.onboarding-modal')).toBeNull()
|
|
338
338
|
})
|
|
339
339
|
|
|
340
|
+
it('closes the optional onboarding dialog from the team confirm action as well', async () => {
|
|
341
|
+
const context = document.createElement(ACCOUNT_CONTEXT_TAG)
|
|
342
|
+
context.configure({
|
|
343
|
+
applicationName: APPLICATION_NAME,
|
|
344
|
+
transport: { load: async () => serverProjection() },
|
|
345
|
+
organizationOnboarding: { transport: createMockOrganizationOnboardingTransport() },
|
|
346
|
+
})
|
|
347
|
+
document.body.append(context)
|
|
348
|
+
await vi.waitFor(() => expect(context.shadowRoot?.textContent).toContain('企业 A'))
|
|
349
|
+
|
|
350
|
+
context.startOrganizationOnboarding()
|
|
351
|
+
await settle(context)
|
|
352
|
+
const onboarding = context.shadowRoot?.querySelector('uniplat-internal-organization-onboarding')
|
|
353
|
+
const onboardingRoot = onboarding?.shadowRoot
|
|
354
|
+
|
|
355
|
+
const options = [...(onboardingRoot?.querySelectorAll<HTMLButtonElement>('.option') ?? [])]
|
|
356
|
+
options[1]?.click()
|
|
357
|
+
await onboarding?.updateComplete
|
|
358
|
+
onboardingRoot?.querySelector<HTMLButtonElement>('[part="primary-action"]')?.click()
|
|
359
|
+
await onboarding?.updateComplete
|
|
360
|
+
|
|
361
|
+
const teamName = onboardingRoot?.querySelector<HTMLInputElement>('[part="input"]')
|
|
362
|
+
if (!teamName) throw new Error('Missing team name input')
|
|
363
|
+
teamName.value = '更更更小的团队'
|
|
364
|
+
teamName.dispatchEvent(new Event('input', { bubbles: true }))
|
|
365
|
+
await onboarding?.updateComplete
|
|
366
|
+
onboardingRoot?.querySelector('form')?.dispatchEvent(new Event('submit', { bubbles: true }))
|
|
367
|
+
await vi.waitFor(() => expect(onboardingRoot?.textContent).toContain('已创建'))
|
|
368
|
+
|
|
369
|
+
// 已有归属的用户走的是非强制态,"确认"同样必须收起对话框。
|
|
370
|
+
onboardingRoot?.querySelector<HTMLButtonElement>('.success-actions button')?.click()
|
|
371
|
+
await settle(context)
|
|
372
|
+
expect(context.shadowRoot?.querySelector('dialog.onboarding-modal')).toBeNull()
|
|
373
|
+
expect(context.shadowRoot?.querySelector('[part="onboarding-panel"]')).toBeNull()
|
|
374
|
+
})
|
|
375
|
+
|
|
340
376
|
it('centers the optional onboarding flow in a dialog that can still be dismissed', async () => {
|
|
341
377
|
const context = document.createElement(ACCOUNT_CONTEXT_TAG)
|
|
342
378
|
context.configure({
|