feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
import { render, screen, fireEvent } from '@testing-library/react'
|
2026-04-18 18:09:37 +02:00
|
|
|
import { beforeEach, describe, it, expect, vi } from 'vitest'
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
import { WelcomeScreen } from './WelcomeScreen'
|
2026-04-20 00:45:14 +02:00
|
|
|
import tolariaIcon from '@/assets/tolaria-icon.svg'
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
|
2026-04-18 18:09:37 +02:00
|
|
|
const dragRegionMouseDown = vi.fn()
|
|
|
|
|
|
|
|
|
|
vi.mock('../hooks/useDragRegion', () => ({
|
|
|
|
|
useDragRegion: () => ({ onMouseDown: dragRegionMouseDown }),
|
|
|
|
|
}))
|
|
|
|
|
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
const defaultProps = {
|
|
|
|
|
mode: 'welcome' as const,
|
|
|
|
|
defaultVaultPath: '~/Documents/Laputa',
|
|
|
|
|
onCreateVault: vi.fn(),
|
2026-04-07 23:28:02 +02:00
|
|
|
onRetryCreateVault: vi.fn(),
|
2026-04-19 01:06:40 +02:00
|
|
|
onCreateEmptyVault: vi.fn(),
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
onOpenFolder: vi.fn(),
|
2026-04-12 19:17:49 +02:00
|
|
|
isOffline: false,
|
2026-04-07 23:28:02 +02:00
|
|
|
creatingAction: null as 'template' | 'empty' | null,
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
error: null,
|
2026-04-07 23:28:02 +02:00
|
|
|
canRetryTemplate: false,
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
describe('WelcomeScreen', () => {
|
2026-04-18 18:09:37 +02:00
|
|
|
beforeEach(() => {
|
|
|
|
|
vi.clearAllMocks()
|
|
|
|
|
})
|
|
|
|
|
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
describe('welcome mode', () => {
|
|
|
|
|
it('renders welcome title and subtitle', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
2026-04-12 01:35:34 +02:00
|
|
|
expect(screen.getByText('Welcome to Tolaria')).toBeInTheDocument()
|
2026-04-20 00:45:14 +02:00
|
|
|
expect(screen.getByText('Markdown knowledge management for the age of AI')).toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('renders the local Tolaria branding icon', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
|
|
|
|
|
|
|
|
|
const brandIcon = screen.getByAltText('Tolaria icon')
|
|
|
|
|
expect(brandIcon).toHaveAttribute('src', tolariaIcon)
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
|
2026-04-20 11:04:29 +02:00
|
|
|
it('shows the onboarding actions in the guided-first order', () => {
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
2026-04-20 11:04:29 +02:00
|
|
|
|
|
|
|
|
const optionButtons = screen.getAllByRole('button')
|
|
|
|
|
expect(optionButtons[0]).toBe(screen.getByTestId('welcome-create-vault'))
|
|
|
|
|
expect(optionButtons[1]).toBe(screen.getByTestId('welcome-create-new'))
|
|
|
|
|
expect(optionButtons[2]).toBe(screen.getByTestId('welcome-open-folder'))
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
|
2026-04-18 00:21:52 +02:00
|
|
|
it('focuses the first action for keyboard users', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
2026-04-20 11:04:29 +02:00
|
|
|
expect(screen.getByTestId('welcome-create-vault')).toHaveFocus()
|
2026-04-18 00:21:52 +02:00
|
|
|
})
|
|
|
|
|
|
2026-04-19 14:23:05 +02:00
|
|
|
it('shows the simplified template option description', () => {
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
2026-04-19 14:30:07 +02:00
|
|
|
expect(screen.getByText('Download the getting started vault')).toBeInTheDocument()
|
2026-04-19 14:23:05 +02:00
|
|
|
expect(screen.queryByText(/~\/Documents\/Laputa/)).not.toBeInTheDocument()
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
|
2026-04-12 19:17:49 +02:00
|
|
|
it('shows offline guidance and disables the template option when offline', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} isOffline={true} />)
|
|
|
|
|
expect(screen.getByTestId('welcome-create-vault')).toBeDisabled()
|
|
|
|
|
expect(screen.getByText(/Requires internet — clone later/)).toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
2026-04-19 01:06:40 +02:00
|
|
|
it('calls onCreateEmptyVault when create empty button is clicked', () => {
|
|
|
|
|
const onCreateEmptyVault = vi.fn()
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} onCreateEmptyVault={onCreateEmptyVault} />)
|
2026-04-04 14:25:52 +02:00
|
|
|
fireEvent.click(screen.getByTestId('welcome-create-new'))
|
2026-04-19 01:06:40 +02:00
|
|
|
expect(onCreateEmptyVault).toHaveBeenCalledOnce()
|
2026-04-04 14:25:52 +02:00
|
|
|
})
|
|
|
|
|
|
2026-04-19 02:37:29 +02:00
|
|
|
it('calls onCreateEmptyVault when create empty button is activated with Enter', () => {
|
|
|
|
|
const onCreateEmptyVault = vi.fn()
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} onCreateEmptyVault={onCreateEmptyVault} />)
|
|
|
|
|
const button = screen.getByTestId('welcome-create-new')
|
|
|
|
|
|
|
|
|
|
button.focus()
|
|
|
|
|
fireEvent.keyDown(button, { key: 'Enter' })
|
|
|
|
|
|
|
|
|
|
expect(onCreateEmptyVault).toHaveBeenCalledOnce()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('calls onCreateEmptyVault when create empty button is activated with Space', () => {
|
|
|
|
|
const onCreateEmptyVault = vi.fn()
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} onCreateEmptyVault={onCreateEmptyVault} />)
|
|
|
|
|
const button = screen.getByTestId('welcome-create-new')
|
|
|
|
|
|
|
|
|
|
button.focus()
|
|
|
|
|
fireEvent.keyDown(button, { key: ' ' })
|
|
|
|
|
|
|
|
|
|
expect(onCreateEmptyVault).toHaveBeenCalledOnce()
|
|
|
|
|
})
|
|
|
|
|
|
2026-04-04 14:25:52 +02:00
|
|
|
it('calls onCreateVault when template button is clicked', () => {
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
const onCreateVault = vi.fn()
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} onCreateVault={onCreateVault} />)
|
|
|
|
|
fireEvent.click(screen.getByTestId('welcome-create-vault'))
|
|
|
|
|
expect(onCreateVault).toHaveBeenCalledOnce()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('calls onOpenFolder when open folder button is clicked', () => {
|
|
|
|
|
const onOpenFolder = vi.fn()
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} onOpenFolder={onOpenFolder} />)
|
|
|
|
|
fireEvent.click(screen.getByTestId('welcome-open-folder'))
|
|
|
|
|
expect(onOpenFolder).toHaveBeenCalledOnce()
|
|
|
|
|
})
|
|
|
|
|
|
2026-04-19 02:37:29 +02:00
|
|
|
it('cycles onboarding actions with Tab and activates the selected action with Enter', () => {
|
2026-04-20 11:04:29 +02:00
|
|
|
const onCreateEmptyVault = vi.fn()
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} onCreateEmptyVault={onCreateEmptyVault} />)
|
2026-04-19 02:37:29 +02:00
|
|
|
|
|
|
|
|
fireEvent.keyDown(window, { key: 'Tab' })
|
|
|
|
|
fireEvent.keyDown(window, { key: 'Enter' })
|
|
|
|
|
|
2026-04-20 11:04:29 +02:00
|
|
|
expect(onCreateEmptyVault).toHaveBeenCalledOnce()
|
2026-04-19 02:37:29 +02:00
|
|
|
})
|
|
|
|
|
|
2026-04-04 14:25:52 +02:00
|
|
|
it('disables all buttons while creating', () => {
|
2026-04-07 23:28:02 +02:00
|
|
|
render(<WelcomeScreen {...defaultProps} creatingAction="template" />)
|
2026-04-04 14:25:52 +02:00
|
|
|
expect(screen.getByTestId('welcome-create-new')).toBeDisabled()
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
expect(screen.getByTestId('welcome-open-folder')).toBeDisabled()
|
2026-04-04 14:25:52 +02:00
|
|
|
expect(screen.getByTestId('welcome-create-vault')).toBeDisabled()
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
|
2026-04-04 14:25:52 +02:00
|
|
|
it('shows loading text on template button while creating', () => {
|
2026-04-07 23:28:02 +02:00
|
|
|
render(<WelcomeScreen {...defaultProps} creatingAction="template" />)
|
|
|
|
|
expect(screen.getByTestId('welcome-create-vault')).toHaveTextContent(/Downloading template/)
|
|
|
|
|
expect(screen.getByTestId('welcome-status')).toHaveAttribute('aria-live', 'polite')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('shows loading text on create-new button while creating an empty vault', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} creatingAction="empty" />)
|
|
|
|
|
expect(screen.getByTestId('welcome-create-new')).toHaveTextContent(/Creating vault/)
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('shows error message when error is set', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} error="Permission denied" />)
|
|
|
|
|
expect(screen.getByTestId('welcome-error')).toHaveTextContent('Permission denied')
|
2026-04-07 23:28:02 +02:00
|
|
|
expect(screen.getByTestId('welcome-error')).toHaveAttribute('aria-live', 'assertive')
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('does not show error when error is null', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
|
|
|
|
expect(screen.queryByTestId('welcome-error')).not.toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
2026-04-07 23:28:02 +02:00
|
|
|
it('shows a retry button after template download errors', () => {
|
|
|
|
|
const onRetryCreateVault = vi.fn()
|
|
|
|
|
render(
|
|
|
|
|
<WelcomeScreen
|
|
|
|
|
{...defaultProps}
|
|
|
|
|
error="Could not download Getting Started vault. Check your connection and try again."
|
|
|
|
|
canRetryTemplate={true}
|
|
|
|
|
onRetryCreateVault={onRetryCreateVault}
|
|
|
|
|
/>,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
fireEvent.click(screen.getByTestId('welcome-retry-template'))
|
|
|
|
|
expect(onRetryCreateVault).toHaveBeenCalledOnce()
|
|
|
|
|
})
|
|
|
|
|
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
it('does not show path badge in welcome mode', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
|
|
|
|
expect(screen.queryByText('~/Laputa')).not.toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('vault-missing mode', () => {
|
|
|
|
|
const missingProps = {
|
|
|
|
|
...defaultProps,
|
|
|
|
|
mode: 'vault-missing' as const,
|
|
|
|
|
missingPath: '~/Laputa',
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
it('renders vault not found title', () => {
|
|
|
|
|
render(<WelcomeScreen {...missingProps} />)
|
|
|
|
|
expect(screen.getByText('Vault not found')).toBeInTheDocument()
|
|
|
|
|
expect(screen.getByText(/could not be found on disk/)).toBeInTheDocument()
|
|
|
|
|
})
|
|
|
|
|
|
2026-04-07 22:35:04 +02:00
|
|
|
it('does not show the missing vault path in a badge', () => {
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
render(<WelcomeScreen {...missingProps} />)
|
2026-04-07 22:35:04 +02:00
|
|
|
expect(screen.queryByText('~/Laputa')).not.toBeInTheDocument()
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
|
2026-04-04 14:25:52 +02:00
|
|
|
it('shows "Choose a different folder" instead of "Open existing vault"', () => {
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
render(<WelcomeScreen {...missingProps} />)
|
|
|
|
|
expect(screen.getByTestId('welcome-open-folder')).toHaveTextContent('Choose a different folder')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('data-testid', () => {
|
|
|
|
|
it('has welcome-screen container testid', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
|
|
|
|
expect(screen.getByTestId('welcome-screen')).toBeInTheDocument()
|
|
|
|
|
})
|
2026-04-18 18:09:37 +02:00
|
|
|
|
|
|
|
|
it('uses the surrounding surface as a drag region and excludes the card', () => {
|
|
|
|
|
render(<WelcomeScreen {...defaultProps} />)
|
|
|
|
|
|
|
|
|
|
const screenContainer = screen.getByTestId('welcome-screen')
|
|
|
|
|
fireEvent.mouseDown(screenContainer)
|
|
|
|
|
|
|
|
|
|
expect(dragRegionMouseDown).toHaveBeenCalledOnce()
|
|
|
|
|
expect(screenContainer.querySelector('[data-no-drag]')).not.toBeNull()
|
|
|
|
|
})
|
feat: integrate welcome screen with tests and fix App tests
WelcomeScreen component (14 tests):
- welcome mode: title, buttons, hint, loading, error states
- vault-missing mode: path badge, different button labels
useOnboarding hook (10 tests):
- vault exists → ready, vault missing → welcome
- dismissed + missing → vault-missing
- create vault, open folder, dismiss transitions
- error handling, picker cancellation, command failure fallback
App.test.tsx updated to mock new Tauri commands
(check_vault_exists, get_default_vault_path).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 12:55:35 +01:00
|
|
|
})
|
|
|
|
|
})
|