Skip to content

Commit 38b62cd

Browse files
committed
Add failing test case for a non-background image style
1 parent 5a2d306 commit 38b62cd

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

plugins/image-prioritizer/tests/test-helper.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,34 @@ public function data_provider_test_filter_tag_walker_visitors(): array {
8686
',
8787
),
8888

89+
'no-url-metrics-with-non-background-image-style' => array(
90+
'set_up' => static function (): void {},
91+
'buffer' => '
92+
<html lang="en">
93+
<head>
94+
<meta charset="utf-8">
95+
<title>...</title>
96+
</head>
97+
<body>
98+
<div style="background-color: black; color: white; width:100%; height: 200px;">This is so background!</div>
99+
</body>
100+
</html>
101+
',
102+
// There should be no data-od-xpath added to the DIV because it is using a data: URL for the background-image.
103+
'expected' => '
104+
<html lang="en">
105+
<head>
106+
<meta charset="utf-8">
107+
<title>...</title>
108+
</head>
109+
<body>
110+
<div style="background-color: black; color: white; width:100%; height: 200px;">This is so background!</div>
111+
<script type="module">/* import detect ... */</script>
112+
</body>
113+
</html>
114+
',
115+
),
116+
89117
'no-url-metrics-with-data-url-image' => array(
90118
'set_up' => static function (): void {},
91119
// Smallest PNG courtesy of <https://evanhahn.com/worlds-smallest-png/>.

0 commit comments

Comments
 (0)