Skip to content

Commit f4e0396

Browse files
Alexandr FedoroviText-CI
Alexandr Fedorov
authored andcommitted
Add tests for pseudo class css parsing
DEVSIX-8925 Autoported commit. Original commit hash: [021f1074b]
1 parent 59aba55 commit f4e0396

12 files changed

+122
-1
lines changed

itext.tests/itext.html2pdf.tests/itext/html2pdf/css/PseudoElementsTest.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,36 @@ public virtual void PseudoContentWithAutoWidthAndHeightTest() {
5959
ConvertToPdfAndCompare("pseudoContentWithAutoWidthAndHeightTest", SOURCE_FOLDER, DESTINATION_FOLDER);
6060
}
6161

62+
[NUnit.Framework.Test]
63+
public virtual void CssWithListOfSelectorsInPseudoClassTest() {
64+
ConvertToPdfAndCompare("pseudoClassTest", SOURCE_FOLDER, DESTINATION_FOLDER);
65+
}
66+
67+
[NUnit.Framework.Test]
68+
public virtual void InvalidPseudoClassWithCommaSelectorTest() {
69+
ConvertToPdfAndCompare("invalidPseudoClassWithCommaSelector", SOURCE_FOLDER, DESTINATION_FOLDER);
70+
}
71+
72+
[NUnit.Framework.Test]
73+
public virtual void DifferentArgumentsInNotClassTest() {
74+
ConvertToPdfAndCompare("invalidPseudoClassWithCommaSelector", SOURCE_FOLDER, DESTINATION_FOLDER);
75+
}
76+
77+
[NUnit.Framework.Test]
78+
public virtual void NotFirstPseudoClassTest() {
79+
ConvertToPdfAndCompare("notFirstPseudoClassTest", SOURCE_FOLDER, DESTINATION_FOLDER);
80+
}
81+
82+
[NUnit.Framework.Test]
83+
public virtual void AddingNewContentInPseudoClassTest() {
84+
ConvertToPdfAndCompare("addingNewContentInPseudoClassTest", SOURCE_FOLDER, DESTINATION_FOLDER);
85+
}
86+
87+
[NUnit.Framework.Test]
88+
public virtual void ComplexPseudoClassTest() {
89+
ConvertToPdfAndCompare("complexPseudoClassTest", SOURCE_FOLDER, DESTINATION_FOLDER);
90+
}
91+
6292
[NUnit.Framework.Test]
6393
public virtual void BeforeAfterPseudoTest01() {
6494
ConvertToPdfAndCompare("beforeAfterPseudoTest01", SOURCE_FOLDER, DESTINATION_FOLDER);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<style>
5+
b:not(:last-of-type)::after {
6+
content: "!!!";
7+
}
8+
</style>
9+
</head>
10+
<body>
11+
<p>
12+
<b>Mars</b> is one of the most Earth-like planets. <b>Mars</b> day is almost the same as an Earth day, only
13+
<strong>37 minutes</strong> longer.
14+
</p>
15+
</body>
16+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<style>
5+
strong:not([data-time="37"], :empty, b.warning) {
6+
color: forestgreen;
7+
}
8+
</style>
9+
</head>
10+
<body>
11+
<p>
12+
<b>Mars</b> is one of the most Earth-like planets. <b>Mars</b> day is almost the same as an Earth day, only
13+
<strong>37 minutes</strong> longer.
14+
</p>
15+
</body>
16+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<style>
5+
p:not(.irrelevant),,, {
6+
font-weight: bold;
7+
}
8+
</style>
9+
</head>
10+
<body>
11+
<p>
12+
<b>Mars</b> is one of the most Earth-like planets. <b>Mars</b> day is almost the same as an Earth day, only
13+
<strong>37 minutes</strong> longer.
14+
</p>
15+
</body>
16+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<style>
5+
b:not(:first-of-type) {
6+
color: red;
7+
}
8+
</style>
9+
</head>
10+
<body>
11+
<p>
12+
<b>Mars</b> is one of the most Earth-like planets. <b>Mars</b> day is almost the same as an Earth day, only
13+
<strong>37 minutes</strong> longer.
14+
</p>
15+
</body>
16+
</html>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<style>
5+
p:not(.irrelevant) {
6+
font-weight: bold;
7+
}
8+
p > strong,
9+
p > b.important {
10+
color: crimson;
11+
}
12+
p > :not(strong, b.important) {
13+
color: darkmagenta;
14+
}
15+
</style>
16+
</head>
17+
<body>
18+
<p>
19+
<b>Mars</b> is one of the most Earth-like planets. <b>Mars</b> day is almost the same as an Earth day, only
20+
<strong>37 minutes</strong> longer.
21+
</p>
22+
<p class="irrelevant">
23+
<b class="important">NASA</b>'s Jet <del>Momentum</del> Propulsion Laboratory is designing mission concepts to survive
24+
the <b>Venus</b> extreme temperatures and atmospheric pressure.
25+
</p>
26+
</body>
27+
</html>

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
588ccc2b8512329f1c06b5d4345fc708bd054394
1+
021f1074b588b0f225854d4a3a09e832eb15212d

0 commit comments

Comments
 (0)