@@ -39,7 +39,7 @@ describe("XFAFactory", function () {
39
39
}
40
40
41
41
describe ( "toHTML" , function ( ) {
42
- it ( "should convert some basic properties to CSS" , function ( ) {
42
+ it ( "should convert some basic properties to CSS" , async ( ) => {
43
43
const xml = `
44
44
<?xml version="1.0"?>
45
45
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -86,9 +86,9 @@ describe("XFAFactory", function () {
86
86
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
87
87
factory . setFonts ( [ ] ) ;
88
88
89
- expect ( factory . numPages ) . toEqual ( 2 ) ;
89
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 2 ) ;
90
90
91
- const pages = factory . getPages ( ) ;
91
+ const pages = await factory . getPages ( ) ;
92
92
const page1 = pages . children [ 0 ] ;
93
93
expect ( page1 . attributes . style ) . toEqual ( {
94
94
height : "789px" ,
@@ -144,7 +144,7 @@ describe("XFAFactory", function () {
144
144
) ;
145
145
} ) ;
146
146
147
- it ( "should have an alt attribute from toolTip" , function ( ) {
147
+ it ( "should have an alt attribute from toolTip" , async ( ) => {
148
148
if ( isNodeJS ) {
149
149
pending ( "Image is not supported in Node.js." ) ;
150
150
}
@@ -174,15 +174,15 @@ describe("XFAFactory", function () {
174
174
` ;
175
175
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
176
176
177
- expect ( factory . numPages ) . toEqual ( 1 ) ;
177
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
178
178
179
- const pages = factory . getPages ( ) ;
179
+ const pages = await factory . getPages ( ) ;
180
180
const field = searchHtmlNode ( pages , "name" , "img" ) ;
181
181
182
182
expect ( field . attributes . alt ) . toEqual ( "alt text" ) ;
183
183
} ) ;
184
184
185
- it ( "should have a aria heading role and level" , function ( ) {
185
+ it ( "should have a aria heading role and level" , async ( ) => {
186
186
const xml = `
187
187
<?xml version="1.0"?>
188
188
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -208,9 +208,9 @@ describe("XFAFactory", function () {
208
208
` ;
209
209
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
210
210
211
- expect ( factory . numPages ) . toEqual ( 1 ) ;
211
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
212
212
213
- const pages = factory . getPages ( ) ;
213
+ const pages = await factory . getPages ( ) ;
214
214
const page1 = pages . children [ 0 ] ;
215
215
const wrapper = page1 . children [ 0 ] ;
216
216
const draw = wrapper . children [ 0 ] ;
@@ -219,7 +219,7 @@ describe("XFAFactory", function () {
219
219
expect ( draw . attributes [ "aria-level" ] ) . toEqual ( "2" ) ;
220
220
} ) ;
221
221
222
- it ( "should have aria table role" , function ( ) {
222
+ it ( "should have aria table role" , async ( ) => {
223
223
const xml = `
224
224
<?xml version="1.0"?>
225
225
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -263,9 +263,9 @@ describe("XFAFactory", function () {
263
263
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
264
264
factory . setFonts ( [ ] ) ;
265
265
266
- expect ( factory . numPages ) . toEqual ( 1 ) ;
266
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
267
267
268
- const pages = factory . getPages ( ) ;
268
+ const pages = await factory . getPages ( ) ;
269
269
const table = searchHtmlNode (
270
270
pages ,
271
271
"xfaName" ,
@@ -303,7 +303,7 @@ describe("XFAFactory", function () {
303
303
expect ( cell . attributes . role ) . toEqual ( "cell" ) ;
304
304
} ) ;
305
305
306
- it ( "should have a maxLength property" , function ( ) {
306
+ it ( "should have a maxLength property" , async ( ) => {
307
307
const xml = `
308
308
<?xml version="1.0"?>
309
309
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -336,15 +336,15 @@ describe("XFAFactory", function () {
336
336
` ;
337
337
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
338
338
339
- expect ( factory . numPages ) . toEqual ( 1 ) ;
339
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
340
340
341
- const pages = factory . getPages ( ) ;
341
+ const pages = await factory . getPages ( ) ;
342
342
const field = searchHtmlNode ( pages , "name" , "input" ) ;
343
343
344
344
expect ( field . attributes . maxLength ) . toEqual ( 123 ) ;
345
345
} ) ;
346
346
347
- it ( "should have an aria-label property from speak" , function ( ) {
347
+ it ( "should have an aria-label property from speak" , async ( ) => {
348
348
const xml = `
349
349
<?xml version="1.0"?>
350
350
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -378,15 +378,15 @@ describe("XFAFactory", function () {
378
378
` ;
379
379
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
380
380
381
- expect ( factory . numPages ) . toEqual ( 1 ) ;
381
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
382
382
383
- const pages = factory . getPages ( ) ;
383
+ const pages = await factory . getPages ( ) ;
384
384
const field = searchHtmlNode ( pages , "name" , "input" ) ;
385
385
386
386
expect ( field . attributes [ "aria-label" ] ) . toEqual ( "Screen Reader" ) ;
387
387
} ) ;
388
388
389
- it ( "should have an aria-label property from toolTip" , function ( ) {
389
+ it ( "should have an aria-label property from toolTip" , async ( ) => {
390
390
const xml = `
391
391
<?xml version="1.0"?>
392
392
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -420,15 +420,15 @@ describe("XFAFactory", function () {
420
420
` ;
421
421
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
422
422
423
- expect ( factory . numPages ) . toEqual ( 1 ) ;
423
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
424
424
425
- const pages = factory . getPages ( ) ;
425
+ const pages = await factory . getPages ( ) ;
426
426
const field = searchHtmlNode ( pages , "name" , "input" ) ;
427
427
428
428
expect ( field . attributes [ "aria-label" ] ) . toEqual ( "Screen Reader" ) ;
429
429
} ) ;
430
430
431
- it ( "should have an input or textarea" , function ( ) {
431
+ it ( "should have an input or textarea" , async ( ) => {
432
432
const xml = `
433
433
<?xml version="1.0"?>
434
434
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -463,9 +463,9 @@ describe("XFAFactory", function () {
463
463
` ;
464
464
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
465
465
466
- expect ( factory . numPages ) . toEqual ( 1 ) ;
466
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
467
467
468
- const pages = factory . getPages ( ) ;
468
+ const pages = await factory . getPages ( ) ;
469
469
const field1 = searchHtmlNode ( pages , "name" , "input" ) ;
470
470
expect ( field1 ) . not . toEqual ( null ) ;
471
471
@@ -474,7 +474,7 @@ describe("XFAFactory", function () {
474
474
} ) ;
475
475
} ) ;
476
476
477
- it ( "should have an input or textarea" , function ( ) {
477
+ it ( "should have an input or textarea" , async ( ) => {
478
478
const xml = `
479
479
<?xml version="1.0"?>
480
480
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -517,15 +517,15 @@ describe("XFAFactory", function () {
517
517
` ;
518
518
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
519
519
520
- expect ( factory . numPages ) . toEqual ( 1 ) ;
520
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
521
521
522
- const pages = factory . getPages ( ) ;
522
+ const pages = await factory . getPages ( ) ;
523
523
const field1 = searchHtmlNode ( pages , "name" , "input" ) ;
524
524
expect ( field1 ) . not . toEqual ( null ) ;
525
525
expect ( field1 . attributes . value ) . toEqual ( "123" ) ;
526
526
} ) ;
527
527
528
- it ( "should parse URLs correctly" , function ( ) {
528
+ it ( "should parse URLs correctly" , async ( ) => {
529
529
function getXml ( href ) {
530
530
return `
531
531
<?xml version="1.0"?>
@@ -560,38 +560,38 @@ describe("XFAFactory", function () {
560
560
561
561
// A valid, and complete, URL.
562
562
factory = new XFAFactory ( { "xdp:xdp" : getXml ( "https://www.example.com/" ) } ) ;
563
- expect ( factory . numPages ) . toEqual ( 1 ) ;
564
- pages = factory . getPages ( ) ;
563
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
564
+ pages = await factory . getPages ( ) ;
565
565
a = searchHtmlNode ( pages , "name" , "a" ) ;
566
566
expect ( a . value ) . toEqual ( "https://www.example.com/" ) ;
567
567
expect ( a . attributes . href ) . toEqual ( "https://www.example.com/" ) ;
568
568
569
569
// A valid, but incomplete, URL.
570
570
factory = new XFAFactory ( { "xdp:xdp" : getXml ( "www.example.com/" ) } ) ;
571
- expect ( factory . numPages ) . toEqual ( 1 ) ;
572
- pages = factory . getPages ( ) ;
571
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
572
+ pages = await factory . getPages ( ) ;
573
573
a = searchHtmlNode ( pages , "name" , "a" ) ;
574
574
expect ( a . value ) . toEqual ( "www.example.com/" ) ;
575
575
expect ( a . attributes . href ) . toEqual ( "http://www.example.com/" ) ;
576
576
577
577
// A valid email-address.
578
578
factory = new XFAFactory ( { "xdp:xdp" :
getXml ( "mailto:[email protected] " ) } ) ;
579
- expect ( factory . numPages ) . toEqual ( 1 ) ;
580
- pages = factory . getPages ( ) ;
579
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
580
+ pages = await factory . getPages ( ) ;
581
581
a = searchHtmlNode ( pages , "name" , "a" ) ;
582
582
expect ( a . value ) . toEqual ( "mailto:[email protected] " ) ;
583
583
expect ( a . attributes . href ) . toEqual ( "mailto:[email protected] " ) ;
584
584
585
585
// Not a valid URL.
586
586
factory = new XFAFactory ( { "xdp:xdp" : getXml ( "qwerty/" ) } ) ;
587
- expect ( factory . numPages ) . toEqual ( 1 ) ;
588
- pages = factory . getPages ( ) ;
587
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
588
+ pages = await factory . getPages ( ) ;
589
589
a = searchHtmlNode ( pages , "name" , "a" ) ;
590
590
expect ( a . value ) . toEqual ( "qwerty/" ) ;
591
591
expect ( a . attributes . href ) . toEqual ( "" ) ;
592
592
} ) ;
593
593
594
- it ( "should replace button with an URL by a link" , function ( ) {
594
+ it ( "should replace button with an URL by a link" , async ( ) => {
595
595
const xml = `
596
596
<?xml version="1.0"?>
597
597
<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/">
@@ -635,9 +635,9 @@ describe("XFAFactory", function () {
635
635
` ;
636
636
const factory = new XFAFactory ( { "xdp:xdp" : xml } ) ;
637
637
638
- expect ( factory . numPages ) . toEqual ( 1 ) ;
638
+ expect ( await factory . getNumPages ( ) ) . toEqual ( 1 ) ;
639
639
640
- const pages = factory . getPages ( ) ;
640
+ const pages = await factory . getPages ( ) ;
641
641
let a = searchHtmlNode ( pages , "name" , "a" ) ;
642
642
expect ( a . attributes . href ) . toEqual ( "https://github.com/mozilla/pdf.js" ) ;
643
643
expect ( a . attributes . newWindow ) . toEqual ( true ) ;
0 commit comments