import React from 'react'; import { beforeEach, describe, expect, mock, test } from 'bun:test'; import { renderToStaticMarkup } from 'react-dom/server'; import { I18nProvider } from '@/lib/i18n'; mock.module('@/components/ui/dialog', () => ({ Dialog: ({ children }: React.PropsWithChildren) => <>{children}, DialogContent: ({ children }: React.PropsWithChildren) =>
{children}
, DialogDescription: ({ children }: React.PropsWithChildren) =>

{children}

, DialogFooter: ({ children }: React.PropsWithChildren) =>
{children}
, DialogHeader: ({ children }: React.PropsWithChildren) =>
{children}
, DialogTitle: ({ children }: React.PropsWithChildren) =>

{children}

, })); const { AppLinkConfirmDialog } = await import('./AppLinkConfirmDialog'); const { getAppLinkConfirmationSnapshot, openAppLinkWithConfirmation, settleAppLinkConfirmation, } = await import('./appLinkConfirmation'); describe('AppLinkConfirmDialog', () => { beforeEach(() => { if (getAppLinkConfirmationSnapshot()) { settleAppLinkConfirmation('cancel'); } }); test('keeps cancel visible and focused beside both open choices', () => { void openAppLinkWithConfirmation('obsidian://open?vault=Notebook'); const markup = renderToStaticMarkup( , ); expect(markup).toContain('>Cancel'); expect(markup).toContain('autofocus=""'); expect(markup).toContain('>Open once'); expect(markup).toContain('>Trust and open'); settleAppLinkConfirmation('cancel'); }); });