@@ -13,39 +13,58 @@ const withDocument = content => {
1313
1414describe ( "RichText" , ( ) => {
1515 describe ( "MARKS" , ( ) => {
16- const document = withDocument ( [
17- {
18- nodeType : BLOCKS . PARAGRAPH ,
19- content : [
20- {
21- nodeType : 'text' ,
22- value : 'Hello' ,
23- marks : [ { type : MARKS . BOLD } ] ,
24- } ,
25- {
26- nodeType : 'text' ,
27- value : ' world!' ,
28- marks : [ { type : MARKS . ITALIC } ] ,
29- } ,
30- {
31- nodeType : 'text' ,
32- value : 'console.log("yo");' ,
33- marks : [ { type : MARKS . CODE } ] ,
34- } ,
35- {
36- nodeType : 'text' ,
37- value : 'Greetings!' ,
38- marks : [ { type : MARKS . UNDERLINE } ] ,
39- }
40- ] ,
41- }
42- ] ) ;
43- const rendered = mount ( RichText , { propsData : { document } } ) ;
16+ describe ( "consecutive marks" , ( ) => {
17+ const document = withDocument ( [
18+ {
19+ nodeType : BLOCKS . PARAGRAPH ,
20+ content : [
21+ {
22+ nodeType : 'text' ,
23+ value : 'Hello' ,
24+ marks : [ { type : MARKS . BOLD } ] ,
25+ } ,
26+ {
27+ nodeType : 'text' ,
28+ value : ' world!' ,
29+ marks : [ { type : MARKS . ITALIC } ] ,
30+ } ,
31+ {
32+ nodeType : 'text' ,
33+ value : 'console.log("yo");' ,
34+ marks : [ { type : MARKS . CODE } ] ,
35+ } ,
36+ {
37+ nodeType : 'text' ,
38+ value : 'Greetings!' ,
39+ marks : [ { type : MARKS . UNDERLINE } ] ,
40+ }
41+ ] ,
42+ }
43+ ] ) ;
44+ const rendered = mount ( RichText , { propsData : { document } } ) ;
4445
45- it ( "multimark hello world" , ( ) => {
46- expect ( rendered . html ( ) ) . toBe (
47- '<p><strong>Hello</strong><em> world!</em><code>console.log("yo");</code><u>Greetings!</u></p>'
48- ) ;
46+ it ( "renders them all in a single paragraph" , ( ) => {
47+ expect ( rendered . html ( ) ) . toBe (
48+ '<p><strong>Hello</strong><em> world!</em><code>console.log("yo");</code><u>Greetings!</u></p>'
49+ ) ;
50+ } ) ;
51+ } ) ;
52+
53+ describe ( "overlapping marks" , ( ) => {
54+ const document = withDocument ( [
55+ {
56+ nodeType : 'text' ,
57+ value : 'Hello' ,
58+ marks : [ { type : MARKS . BOLD } , { type : MARKS . ITALIC } , { type : MARKS . UNDERLINE } ] ,
59+ }
60+ ] ) ;
61+ const rendered = mount ( RichText , { propsData : { document } } ) ;
62+
63+ it ( "renders all overlapping marks in order" , ( ) => {
64+ expect ( rendered . html ( ) ) . toBe (
65+ '<strong><em><u>Hello</u></em></strong>'
66+ ) ;
67+ } ) ;
4968 } ) ;
5069 } ) ;
5170
0 commit comments