Skip to content

Commit 07dd6cf

Browse files
IdamkinISnipx
authored andcommitted
Add test illustrating the issue
In html inputs are bigger than enclosing cells and that forces table to split. DEVSIX-3022
1 parent 0237063 commit 07dd6cf

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed

src/test/java/com/itextpdf/html2pdf/element/TableTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,16 @@ public void checkResponsiveTableExample() throws IOException, InterruptedExcepti
521521
runTest("checkResponsiveTableExample");
522522
}
523523

524+
@Test
525+
@LogMessages(messages = {
526+
@LogMessage(messageTemplate = com.itextpdf.io.LogMessageConstant.ELEMENT_DOES_NOT_FIT_AREA, count = 2),
527+
@LogMessage(messageTemplate = LogMessageConstant.INPUT_FIELD_DOES_NOT_FIT, count = 2),
528+
})
529+
//TODO: DEVSIX-3022 - Inputs bigger than enclosing cell force table to split
530+
public void tableWithChildrenBiggerThanCellTest() throws IOException, InterruptedException {
531+
runTest("tableWithChildrenBiggerThanCell");
532+
}
533+
524534
private void runTest(String testName) throws IOException, InterruptedException {
525535
runTest(testName, false);
526536
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<style>
6+
html, body {
7+
font-family: Helvetica, Arial, sans-serif
8+
}
9+
table {
10+
width: 100%;
11+
text-indent: 5px;
12+
border-collapse: collapse
13+
}
14+
table, tbody, tr, td {
15+
border: 1px solid black
16+
}
17+
.content {
18+
background-color: lightcoral;
19+
border: 2px solid darkred;
20+
box-sizing: border-box;
21+
width: 100%
22+
}
23+
.inline-block {
24+
display: inline-block
25+
}
26+
</style>
27+
</head>
28+
<body>
29+
<table>
30+
<tbody>
31+
<tr><td>Start of table</td></tr>
32+
<tr><td><span class="content inline-block">I'm inline-block span</span></td></tr>
33+
<tr><td><input class="content" value="I'm input"></td></tr>
34+
<tr><td><div class="content">I'm div</div></td></tr>
35+
<tr><td><img style="margin-left: 300px" class="content" src="100x100placeholder.png"></td></tr>
36+
<tr><td><span class="content">I'm span</span></td></tr>
37+
<tr style="text-indent: 0"><td><input style="width: 105%" class="content" value="I'm input in no text-indent row but I'm bigger than cell"></td></tr>
38+
<tr><td><div class="content inline-block">I'm inline-block div</div></td></tr>
39+
<tr style="text-indent: 0"><td><table style="width: 105%" class="content"><tbody><tr><td>I'm table in no text-indent row but I'm bigger than cell</td></tr></table></td></tr>
40+
<tr><td>End of table</td></tr>
41+
</tbody>
42+
</table>
43+
</body>
44+
</html>

0 commit comments

Comments
 (0)