@@ -2,17 +2,22 @@ import {builders} from 'prosemirror-test-builder';
22import { createMarkupChecker } from '../../../../tests/sameMarkup' ;
33import { ExtensionsManager } from '../../../core' ;
44import { BaseNode , BaseSchema } from '../../base/BaseSchema' ;
5+ import { bold , Bold } from '../Bold' ;
6+ import { italic , Italic } from '../Italic' ;
57import { code , Code } from './index' ;
68
79const { schema, parser, serializer} = new ExtensionsManager ( {
8- extensions : ( builder ) => builder . use ( BaseSchema , { } ) . use ( Code , { } ) ,
10+ extensions : ( builder ) =>
11+ builder . use ( BaseSchema , { } ) . use ( Bold , { } ) . use ( Code , { } ) . use ( Italic , { } ) ,
912} ) . buildDeps ( ) ;
1013
11- const { doc, p, c} = builders ( schema , {
14+ const { doc, p, b , i , c} = builders ( schema , {
1215 doc : { nodeType : BaseNode . Doc } ,
1316 p : { nodeType : BaseNode . Paragraph } ,
17+ b : { nodeType : bold } ,
18+ i : { nodeType : italic } ,
1419 c : { nodeType : code } ,
15- } ) as PMTestBuilderResult < 'doc' | 'p' , 'c' > ;
20+ } ) as PMTestBuilderResult < 'doc' | 'p' , 'b' | 'i' | ' c'> ;
1621
1722const { same} = createMarkupChecker ( { parser, serializer} ) ;
1823
@@ -21,4 +26,10 @@ describe('Code extension', () => {
2126
2227 it ( 'should parse code inside text' , ( ) =>
2328 same ( 'he`llo wor`ld!' , doc ( p ( 'he' , c ( 'llo wor' ) , 'ld!' ) ) ) ) ;
29+
30+ it ( 'should parse and serialize overlapping inline marks' , ( ) =>
31+ same (
32+ 'This is **strong *emphasized text with `code` in* it**' ,
33+ doc ( p ( 'This is ' , b ( 'strong ' , i ( 'emphasized text with ' , c ( 'code' ) , ' in' ) , ' it' ) ) ) ,
34+ ) ) ;
2435} ) ;
0 commit comments