-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for page-break-before: avoid; and page-break-after: avoid…
…; for <tr> elements
- Loading branch information
Showing
5 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Issues; | ||
|
||
class Issue2004Test extends \Yoast\PHPUnitPolyfills\TestCases\TestCase | ||
{ | ||
|
||
public function testPdfTableBreakAvoid() | ||
{ | ||
// test case: spill items that take about a bit more than half a page, no page-break-avoid would fit them on two pages, with page-break it will be three | ||
$mpdf = new \Mpdf\Mpdf(); | ||
$html = ''; | ||
$itemsPerTwothirdsPage = 28; | ||
for ($i = 0; $i < 3*$itemsPerTwothirdsPage; $i++) { | ||
if ($i % $itemsPerTwothirdsPage == 0) { | ||
$html .= '<tr style=""><td>groupheader</td></tr>'; | ||
} else { | ||
$html .= '<tr style="page-break-before: avoid; background: lime;"><td>content</td></tr>'; | ||
} | ||
} | ||
$mpdf->WriteHTML('<html><body><h1>Test</h1> | ||
<table>'.$html.'</table> | ||
</html>'); | ||
$this->assertEquals($mpdf->page, 3); | ||
} | ||
|
||
} |