Files
tools/vue/editor/src/__test__/interactive.test.ts
T
robonen 09272dffeb feat(editor): eslint/tsconfig migration + type fixes
@robonen/editor: migrate to eslint flat config + composite tsconfig; fix
convergence test type annotations.
2026-06-07 16:30:05 +07:00

20 lines
832 B
TypeScript

import { describe, expect, it } from 'vitest';
import { isInteractiveTarget } from '../view/interactive';
describe('isInteractiveTarget', () => {
it('matches atom controls and contenteditable=false islands, not editor text', () => {
const root = document.createElement('div');
root.setAttribute('contenteditable', 'true');
root.innerHTML = '<p class="text">hi</p><figure contenteditable="false"><input class="cap"></figure>';
document.body.append(root);
expect(isInteractiveTarget(root.querySelector('input.cap'))).toBe(true);
expect(isInteractiveTarget(root.querySelector('figure'))).toBe(true);
expect(isInteractiveTarget(root.querySelector('p.text'))).toBe(false);
expect(isInteractiveTarget(root)).toBe(false);
expect(isInteractiveTarget(null)).toBe(false);
root.remove();
});
});