Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,8 @@ describe('OnboardingCoach', () => {
})
})

it('does not mark the tour complete when its target is absent', async () => {
it('neither completes the tour nor signals the overlay while its target is absent', async () => {
const overlay = useOnboardingOverlayStore()
render(OnboardingCoach, {
props: { steps: STEPS, storageKey: KEY },
global: { plugins: [i18n] }
Expand All @@ -225,6 +226,7 @@ describe('OnboardingCoach', () => {
await nextTick()
expect(screen.queryByRole('dialog')).toBeNull()
expect(localStorage.getItem(KEY)).toBe('false')
expect(overlay.active).toBe(false)
})

it('signals the onboarding overlay while running and clears it when dismissed', async () => {
Expand Down Expand Up @@ -270,5 +272,6 @@ describe('OnboardingCoach', () => {
name: lateSteps[0].title
})
await waitFor(() => expect(dialog).toBeVisible())
expect(useOnboardingOverlayStore().active).toBe(true)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ const { active, index, step, isLast, next, finish } = useOnboarding(
storageKey
)

// Let surfaces like the What's New popup defer while these coach marks run.
// The store drops the source with this component's scope on unmount.
useOnboardingOverlayStore().registerSource(() => active.value)
const titleId = useId()
const bodyId = useId()
const target = ref<HTMLElement | null>(null)
const visible = computed(() => active.value && target.value !== null)
// Let surfaces like the What's New popup defer while a coach card is on
// screen. The store drops the source with this component's scope on unmount.
useOnboardingOverlayStore().registerSource(() => visible.value)
const toolbar = ref<HTMLElement | null>(null)
const card = ref<HTMLElement | null>(null)
const bounds = useElementBounding(target)
Expand Down Expand Up @@ -149,11 +150,7 @@ useEventListener(

<template>
<Teleport to="body">
<div
v-if="active && target"
v-reka-z-index
class="agent-scope fixed inset-0"
>
<div v-if="visible" v-reka-z-index class="agent-scope fixed inset-0">
<div class="absolute inset-0" />
<div
aria-hidden="true"
Expand Down
Loading