@@ -66,4 +66,41 @@ describe('Standard Text', () => {
6666 doc . text ( 20 , 30 , 'This is some normal sized text underneath.' )
6767 comparePdf ( doc . output ( ) , 'different-sizes.pdf' , 'text' )
6868 } )
69+ it ( 'should support multiline text' , ( ) => {
70+ const doc = jsPDF ( )
71+ doc . text ( 20 , 20 , `This is a line
72+ break` )
73+ comparePdf ( doc . output ( ) , 'line-break.pdf' , 'text' )
74+ } )
75+
76+ it ( 'should support multiline text' , ( ) => {
77+ const doc = jsPDF ( )
78+ doc . text ( 'Stroke on' , 20 , 20 , { stroke : true } )
79+ doc . text ( 'Stroke on' , 20 , 40 , { stroke : true } )
80+ doc . text ( 'Stroke off' , 20 , 60 , { stroke : false } )
81+ doc . text ( 'Stroke on' , 20 , 80 , { stroke : true } )
82+
83+ comparePdf ( doc . output ( ) , 'stroke.pdf' , 'text' )
84+ } )
85+
86+ it ( 'should support multiline text' , ( ) => {
87+ const doc = jsPDF ( )
88+ doc . text ( 'Stroke on' , 20 , 20 , { stroke : true } )
89+ doc . text ( 'Stroke on' , 20 , 40 , { stroke : true } )
90+ doc . text ( 'Stroke off' , 20 , 60 , { stroke : false } )
91+ doc . text ( 'Stroke on' , 20 , 80 , { stroke : true } )
92+
93+ comparePdf ( doc . output ( ) , 'stroke.pdf' , 'text' )
94+ } )
95+
96+ // @TODO : Implement passing color as a name
97+ it ( 'should display two red lines of text' , ( ) => {
98+ const doc = jsPDF ( )
99+ doc . setTextColor ( '#FF0000' )
100+ doc . text ( 'Red on' , 20 , 20 )
101+ doc . setTextColor ( 255 , 0 , 0 )
102+ doc . text ( 'Red on' , 20 , 40 )
103+
104+ comparePdf ( doc . output ( ) , 'color.pdf' , 'text' )
105+ } )
69106} )
0 commit comments