@@ -41,91 +41,89 @@ describe("Module: putTotalPages", () => {
4141
4242 comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
4343 } ) ;
44- } ) ;
45-
46- it ( "customfont with encoding without passing fontWeight" , ( ) => {
47- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
48- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
49- var totalPagesExp = "{totalPages}" ;
5044
51- doc . addFileToVFS ( "PTSans.ttf ", PTSans ) ;
52- doc . addFont ( "PTSans.ttf" , " PTSans" , "normal" , "Identity-H ") ;
53-
54- doc . setFont ( "PTSans" ) ;
45+ it ( "customfont with encoding without passing fontWeight ", ( ) => {
46+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf ") ;
47+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
48+ var totalPagesExp = "{totalPages}" ;
5549
56- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
57- doc . addPage ( ) ;
50+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
51+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , "Identity-H" ) ;
5852
59- doc . text ( 10 , 10 , "Page 2 of {totalPages} ") ;
53+ doc . setFont ( "PTSans ") ;
6054
61- if ( typeof doc . putTotalPages === "function" ) {
62- doc . putTotalPages ( totalPagesExp ) ;
63- }
55+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
56+ doc . addPage ( ) ;
6457
65- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
66- } ) ;
58+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
6759
60+ if ( typeof doc . putTotalPages === "function" ) {
61+ doc . putTotalPages ( totalPagesExp ) ;
62+ }
6863
69- it ( "customfont check without passing fontweight in setfont" , ( ) => {
70- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
71- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
72- var totalPagesExp = "{totalPages}" ;
64+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
65+ } ) ;
7366
74- doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
75- doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" ) ;
67+ it ( "customfont check without passing fontweight in setfont" , ( ) => {
68+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
69+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
70+ var totalPagesExp = "{totalPages}" ;
7671
77- doc . setFont ( "PTSans" , 'normal' ) ;
72+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
73+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" ) ;
7874
79- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
80- doc . addPage ( ) ;
75+ doc . setFont ( "PTSans" , "normal" ) ;
8176
82- doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
77+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
78+ doc . addPage ( ) ;
8379
84- if ( typeof doc . putTotalPages === "function" ) {
85- doc . putTotalPages ( totalPagesExp ) ;
86- }
87- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
88- } ) ;
80+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
8981
82+ if ( typeof doc . putTotalPages === "function" ) {
83+ doc . putTotalPages ( totalPagesExp ) ;
84+ }
85+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
86+ } ) ;
9087
91- it ( "customfont with fontweight" , ( ) => {
92- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
93- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
94- var totalPagesExp = "{totalPages}" ;
88+ it ( "customfont with fontweight" , ( ) => {
89+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
90+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
91+ var totalPagesExp = "{totalPages}" ;
9592
96- doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
97- doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , 200 , "Identity-H" ) ;
93+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
94+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , 200 , "Identity-H" ) ;
9895
99- doc . setFont ( "PTSans" , ' normal' , 200 ) ;
96+ doc . setFont ( "PTSans" , " normal" , 200 ) ;
10097
101- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
102- doc . addPage ( ) ;
98+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
99+ doc . addPage ( ) ;
103100
104- doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
101+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
105102
106- if ( typeof doc . putTotalPages === "function" ) {
107- doc . putTotalPages ( totalPagesExp ) ;
108- }
109- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
110- } ) ;
103+ if ( typeof doc . putTotalPages === "function" ) {
104+ doc . putTotalPages ( totalPagesExp ) ;
105+ }
106+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
107+ } ) ;
111108
112- it ( "customfont with samevalue in fontweight and fontstyle " , ( ) => {
113- var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
114- var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
115- var totalPagesExp = "{totalPages}" ;
109+ it ( "customfont with samevalue in fontweight and fontstyle " , ( ) => {
110+ var PTSans = loadBinaryResource ( "reference/PTSans.ttf" ) ;
111+ var doc = new jsPDF ( { filters : [ "ASCIIHexEncode" ] , floatPrecision : 2 } ) ;
112+ var totalPagesExp = "{totalPages}" ;
116113
117- doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
118- doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , "normal" , "Identity-H" ) ;
114+ doc . addFileToVFS ( "PTSans.ttf" , PTSans ) ;
115+ doc . addFont ( "PTSans.ttf" , "PTSans" , "normal" , "normal" , "Identity-H" ) ;
119116
120- doc . setFont ( "PTSans" , ' normal' , "normal" ) ;
117+ doc . setFont ( "PTSans" , " normal" , "normal" ) ;
121118
122- doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
123- doc . addPage ( ) ;
119+ doc . text ( 10 , 10 , "Page 1 of {totalPages}" ) ;
120+ doc . addPage ( ) ;
124121
125- doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
122+ doc . text ( 10 , 10 , "Page 2 of {totalPages}" ) ;
126123
127- if ( typeof doc . putTotalPages === "function" ) {
128- doc . putTotalPages ( totalPagesExp ) ;
129- }
130- comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
124+ if ( typeof doc . putTotalPages === "function" ) {
125+ doc . putTotalPages ( totalPagesExp ) ;
126+ }
127+ comparePdf ( doc . output ( ) , "customfont.pdf" , "putTotalPages" ) ;
128+ } ) ;
131129} ) ;
0 commit comments