Skip to content

Commit 4bf7547

Browse files
committed
test(rich-markdown-editor): assert code-like pastes are claimed but preserved byte-for-byte
The gate is intentionally lenient — a precise CommonMark-emphasis matcher would risk missing real emphasis. Over-claiming is safe because the strict parser (marked) preserves non-markdown exactly; assert the handler claims the paste and returns the input unchanged, not just that no mark is added.
1 parent c92eb17 commit 4bf7547

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,13 @@ describe('markdown paste', () => {
143143
['space-flanked asterisks', 'area = 5 * width * height'],
144144
['python args and kwargs', 'def foo(*args, **kwargs): pass'],
145145
['snake_case identifiers', 'call user_name and file_path_here'],
146-
])('does not emphasize %s (strict CommonMark)', (_label, text) => {
146+
])('claims %s but leaves it byte-for-byte literal (strict CommonMark)', (_label, text) => {
147147
editor = mount()
148-
paste(editor, text)
148+
expect(paste(editor, text)).toBe(true)
149149
const json = JSON.stringify(editor.getJSON())
150150
expect(json).not.toContain('"type":"italic"')
151151
expect(json).not.toContain('"type":"bold"')
152+
expect(editor.getText()).toBe(text)
152153
})
153154

154155
it('parses markdown-shaped plain text even when an HTML sibling is present', () => {

0 commit comments

Comments
 (0)