Skip to content

Commit bf7ba45

Browse files
committed
Implement disabled pseudo class selector. Add some new tests.
DEVSIX-1973
1 parent ad424bc commit bf7ba45

File tree

7 files changed

+54
-0
lines changed

7 files changed

+54
-0
lines changed

src/main/resources/com/itextpdf/html2pdf/default.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ body {
3636
p, dl, multicol {
3737
margin: 1em 0;
3838
}
39+
40+
input:disabled, textarea:disabled {
41+
opacity: 0.4;
42+
background-color: rgb(235, 235, 228);
43+
color: rgb(84, 84, 84);
44+
}
45+
3946
dd {
4047
margin-left: 40px;
4148
margin-bottom: 0;

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,21 @@ public void placeholderTest04() throws IOException, InterruptedException {
210210
runTest("placeholderTest04");
211211
}
212212

213+
@Test
214+
// TODO DEVSIX_1973
215+
public void inputDisabled01AcroTest() throws IOException, InterruptedException {
216+
String htmlPath = sourceFolder + "inputDisabled01Test.html";
217+
String outPdfPath = destinationFolder + "inputDisabled01AcroTest.pdf";
218+
String cmpPdfPath = sourceFolder + "cmp_" + "inputDisabled01AcroTest.pdf";
219+
HtmlConverter.convertToPdf(new File(htmlPath), new File(outPdfPath), new ConverterProperties().setCreateAcroForm(true));
220+
Assert.assertNull(new CompareTool().compareByContent(outPdfPath, cmpPdfPath, destinationFolder));
221+
}
222+
223+
@Test
224+
public void inputDisabled01Test() throws IOException, InterruptedException {
225+
runTest("inputDisabled01Test");
226+
}
227+
213228
@Test
214229
public void placeholderTest05() throws IOException, InterruptedException {
215230
String htmlPath = sourceFolder + "placeholderTest05.html";

src/test/resources/com/itextpdf/html2pdf/css/CssStyleSheetParserTest/cmp_default.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ dl {
5757
multicol {
5858
margin: 1em 0
5959
}
60+
input:disabled {
61+
opacity: 0.4;
62+
background-color: rgb(235,235,228);
63+
color: rgb(84,84,84)
64+
}
65+
textarea:disabled {
66+
opacity: 0.4;
67+
background-color: rgb(235,235,228);
68+
color: rgb(84,84,84)
69+
}
6070
dd {
6171
margin-left: 40px;
6272
margin-bottom: 0;
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<style>
5+
input {
6+
color: red;
7+
}
8+
</style>
9+
</head>
10+
<body>
11+
12+
Disabled: <input type="text" disabled name="FirstD" value="Mickey"><br>
13+
Enabled: <input type="text" name="FirstE" value="Mickey"><br>
14+
Disabled: <input type="checkbox" disabled name="FirstD" value="Mickey"><br>
15+
Enabled: <input type="checkbox" name="FirstE" value="Mickey"><br>
16+
Disabled: <input type="checkbox" disabled checked name="FirstDC" value="Mickey"><br>
17+
Enabled: <input type="checkbox" checked name="FirstEC" value="Mickey"><br>
18+
Disabled: <input disabled name="FirstD" value="Mickey"><br>
19+
Enabled: <input name="FirstE" value="Mickey"><br>
20+
21+
</body>
22+
</html>

0 commit comments

Comments
 (0)