Skip to content

Commit 5581443

Browse files
committed
test(rich-markdown-editor): scope paste tests to what MarkdownPaste actually gates
Inline-only marks (single-asterisk italic, ~~, single-backtick code) are intentionally not detected by looksLikeMarkdown (single `*` would false-positive on e.g. `*args`); they route through the Markdown extension's own paste path, not MarkdownPaste. Move them from the rich-render cases to the defers-to-default cases so the suite tests the handler it names.
1 parent 14b44c2 commit 5581443

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

apps/sim/app/workspace/[workspaceId]/files/components/file-viewer/rich-markdown-editor/markdown-paste.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,17 +104,21 @@ describe('markdown paste', () => {
104104
['empty string', ''],
105105
['whitespace only', ' \n\n '],
106106
['a bare thematic break (ambiguous — needs another markdown signal)', '---'],
107+
['inline-only italic (single asterisk would false-positive on e.g. *args)', 'an *italic* word'],
108+
['inline-only strikethrough', 'a ~~struck~~ word'],
109+
['inline-only code', 'some `code` here'],
107110
])('leaves %s to the default handler', (_label, text) => {
108111
editor = mount()
109112
expect(paste(editor, text)).toBe(false)
110113
})
111114

115+
// Only structural / unambiguous constructs gate the markdown parse. Inline-only marks that
116+
// `looksLikeMarkdown` deliberately omits to avoid false positives — single-asterisk italic
117+
// (`*args`), `~~`, single-backtick code — are covered by the Markdown extension's own paste path,
118+
// not MarkdownPaste, so they belong to a different test surface.
112119
it.each([
113120
['heading', '# Heading', 'heading'],
114121
['bold', 'a **bold** word', 'bold'],
115-
['italic', 'an *italic* word', 'italic'],
116-
['strikethrough', 'a ~~struck~~ word', 'strike'],
117-
['inline code', 'some `code` here', 'code'],
118122
['bullet list', '- one\n- two', 'bulletList'],
119123
['ordered list', '1. one\n2. two', 'orderedList'],
120124
['task list', '- [x] done\n- [ ] todo', 'taskList'],

0 commit comments

Comments
 (0)