Skip to content

Commit 5dd1358

Browse files
committed
test totalPages pageNumber bug
1 parent 4cd8101 commit 5dd1358

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/unit/MpdfDomTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use RowBloom\MpdfRenderer\MpdfDom;
44

5-
test('Dom', function () {
5+
it('substitutes special class elements', function () {
66
$htmlString = '
77
<span class="title"></span>
88
<span class="date"></span>
@@ -24,3 +24,17 @@
2424
->not->toContain('<span class="pageNumber"></span>')
2525
->not->toContain('<span class="totalPages"></span>');
2626
});
27+
28+
test('prod bug', function () {
29+
$output1 = MpdfDom::fromString('{PAGENO}/{nbpg}')
30+
->translateHeaderFooterClasses()
31+
->toHtml();
32+
33+
$output2 = MpdfDom::fromString('<p><span class="pageNumber"></span>/<span class="totalPages"></span></p>')
34+
->translateHeaderFooterClasses()
35+
->toHtml();
36+
37+
expect($output1)->toBe($output2);
38+
39+
expect(strcmp($output1, $output2))->toBe(0);
40+
});

0 commit comments

Comments
 (0)