${expr}`;
return ``;
}),
}));
class MockPlurimath {
constructor() {}
}
import { vMath } from '../directives/v-math';
import { loadPlurimath, mathToHtml } from '../utils/plurimath';
const directive = vMath as import('vue').ObjectDirectiveplain text
'; directive.mounted!(container, {} as any, {} as any, {} as any); expect(container.innerHTML).toBe('plain text
'); }); it('triggers loadPlurimath when math-pending elements exist', async () => { container.innerHTML = 'x^2'; directive.mounted!(container, {} as any, {} as any, {} as any); expect(loadPlurimath).toHaveBeenCalled(); }); it('replaces math-pending elements after loading', async () => { container.innerHTML = 'x^2'; directive.mounted!(container, {} as any, {} as any, {} as any); await vi.waitFor(() => { expect(mathToHtml).toHaveBeenCalledWith('x^2', 'asciimath', false); }); }); it('handles bold math-pending elements', async () => { container.innerHTML = 'alpha'; directive.mounted!(container, {} as any, {} as any, {} as any); await vi.waitFor(() => { expect(mathToHtml).toHaveBeenCalledWith('alpha', 'asciimath', true); }); }); it('skips elements without data-expr', async () => { container.innerHTML = 'no expr'; directive.mounted!(container, {} as any, {} as any, {} as any); await vi.waitFor(() => { expect(mathToHtml).not.toHaveBeenCalled(); }); }); it('uses default format asciimath when data-format is missing', async () => { container.innerHTML = 'x'; directive.mounted!(container, {} as any, {} as any, {} as any); await vi.waitFor(() => { expect(mathToHtml).toHaveBeenCalledWith('x', 'asciimath', false); }); }); });