@@ -12,22 +12,31 @@ describe('getSimplePDFElements', () => {
12
12
<a href="https://pdfobject.com/pdf/sample-3pp.pdf">PDF link</a>
13
13
<a href="https://example.com/some-pdf-without-extension" class="simplepdf">Regular link with class</a>
14
14
<button class="simplepdf">Button with class</button>
15
- <a href="https://yourcompany.simplepdf.com/form/d8d57ec7-f3e9-4fc9-8cc5-4a92c02d30d0" class="simplepdf">SimplePDF form link</a>
15
+ <a href="https://yourcompany.simplepdf.com/form/d8d57ec7-f3e9-4fc9-8cc5-4a92c02d30d0">SimplePDF form link</a>
16
+ <a href="https://yourcompany.simplepdf.com/documents/d8d57ec7-f3e9-4fc9-8cc5-4a92c02d30d0">SimplePDF document link</a>
16
17
<!--Should NOT detect below-->
17
18
<a href="https://pdfobject.com/pdf/sample-3pp.pdf" class="exclude-simplepdf">PDF link with class exclusion</a>
18
19
<a href="https://yourcompany.simplepdf.com/form/d8d57ec7-f3e9-4fc9-8cc5-4a92c02d30d0" class="exclude-simplepdf">SimplePDF form link with exclusion</a>
19
20
<a href="https://www.pdfsomething.com/anything">Regular link containing .pdf</a>
20
21
<a href="https://www.website.com/some-pdf">Should not be opened with SimplePDF</a>
21
22
<a href="https://www.website.com/some-other.pdf.png">Should not be opened with SimplePDF</a>
23
+ <a href="https://www.simplepdf.app/s/article/How-to-Manage-PDF-Settings">Should not be opened with SimplePDF</a>
24
+ <a href="https://www.app.pdf/some-url">Should not be opened with SimplePDF</a>
22
25
</body>
23
26
</html>
24
27
` ,
25
28
{ url : 'http://localhost' } ,
26
29
) ;
27
30
const detectedElements = getSimplePDFElements ( dom . window . document ) ;
28
- expect ( detectedElements ) . toHaveLength ( 4 ) ;
31
+ expect ( detectedElements ) . toHaveLength ( 5 ) ;
29
32
expect ( detectedElements . map ( ( { innerHTML } ) => innerHTML ) ) . toStrictEqual (
30
- expect . arrayContaining ( [ 'Button with class' , 'PDF link' , 'Regular link with class' , 'SimplePDF form link' ] ) ,
33
+ expect . arrayContaining ( [
34
+ 'Button with class' ,
35
+ 'PDF link' ,
36
+ 'Regular link with class' ,
37
+ 'SimplePDF form link' ,
38
+ 'SimplePDF document link' ,
39
+ ] ) ,
31
40
) ;
32
41
} ) ;
33
42
} ) ;
0 commit comments