File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { describe , expect , it } from 'vitest' ;
2+ import { encodeMxEmoticonForMarkdownPlaceholder } from './extensions/matrix-emoticon' ;
23import { markdownToHtml } from './markdownToHtml' ;
34import { htmlToMarkdown } from './htmlToMarkdown' ;
45import { injectDataMd } from './injectDataMd' ;
@@ -108,12 +109,14 @@ describe('bidirectional round-trip', () => {
108109 expect ( result ) . toContain ( 'k.' ) ;
109110 } ) ;
110111
111- it ( 'round-trips img[data-mx-emoticon] tags ' , ( ) => {
112+ it ( 'preserves mx emoticons as editor placeholders (mxc URI + shortcode) ' , ( ) => {
112113 const html = '<img data-mx-emoticon src="mxc://example.org/emote" alt=":blobcat:" />' ;
113114 const injected = injectDataMd ( html ) ;
114115 const result = htmlToMarkdown ( injected ) ;
115- expect ( result ) . toContain ( '<img' ) ;
116- expect ( result ) . toContain ( 'data-mx-emoticon' ) ;
117- expect ( result ) . toContain ( 'mxc://' ) ;
116+ expect ( result ) . not . toContain ( '<img' ) ;
117+ expect ( result ) . toContain (
118+ encodeMxEmoticonForMarkdownPlaceholder ( 'mxc://example.org/emote' , 'blobcat' )
119+ ) ;
120+ expect ( result ) . toContain ( 'mxc://example.org/emote' ) ;
118121 } ) ;
119122} ) ;
You can’t perform that action at this time.
0 commit comments