Skip to content

Commit 93038f6

Browse files
committed
test: Add extra test for complex child selectors
1 parent e2b39c9 commit 93038f6

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

css-inline/tests/test_inlining.rs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,67 @@ fn href_attribute_unchanged() {
221221
);
222222
}
223223

224+
#[test]
225+
fn complex_child_selector() {
226+
let html = r#"<html>
227+
<head>
228+
<title>Test</title>
229+
<style>.parent {
230+
overflow: hidden;
231+
box-shadow: 0 4px 10px 0px rgba(0, 0, 0, 0.1);
232+
}
233+
.parent > table > tbody > tr > td,
234+
.parent > table > tbody > tr > td > div {
235+
border-radius: 3px;
236+
}
237+
</style>
238+
</head>
239+
<body>
240+
<div class="parent">
241+
<table>
242+
<tbody>
243+
<tr>
244+
<td>
245+
<div>
246+
Test
247+
</div>
248+
</td>
249+
</tr>
250+
</tbody>
251+
</table>
252+
</div></body></html>"#;
253+
let inlined = inline(&html).unwrap();
254+
assert_eq!(
255+
inlined,
256+
r#"<html><head>
257+
<title>Test</title>
258+
<style>.parent {
259+
overflow: hidden;
260+
box-shadow: 0 4px 10px 0px rgba(0, 0, 0, 0.1);
261+
}
262+
.parent > table > tbody > tr > td,
263+
.parent > table > tbody > tr > td > div {
264+
border-radius: 3px;
265+
}
266+
</style>
267+
</head>
268+
<body>
269+
<div class="parent" style="overflow: hidden;box-shadow: 0 4px 10px 0px rgba(0, 0, 0, 0.1);">
270+
<table>
271+
<tbody>
272+
<tr>
273+
<td style="border-radius: 3px;">
274+
<div style="border-radius: 3px;">
275+
Test
276+
</div>
277+
</td>
278+
</tr>
279+
</tbody>
280+
</table>
281+
</div></body></html>"#
282+
);
283+
}
284+
224285
#[test]
225286
fn existing_styles() {
226287
// When there is a `style` attribute on a tag that contains a rule

0 commit comments

Comments
 (0)