Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Jan 31, 2025
1 parent 195bb5a commit 61df72e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<html>
<head>
<title>Test</title>
</head>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<html>
<head>
<title>Test</title>
</head>

<script>var rocket_beacon_data = {"ajax_url":"http:\/\/example.org\/wp-admin\/admin-ajax.php","nonce":"96ac96b69e","url":"http:\/\/example.org","is_mobile":false,"width_threshold":1600,"height_threshold":700,"delay":500,"debug":false,"status":{"atf":true,"lrc":true},"elements":"img, video, picture, p, main, div, li, svg, section, header, span","lrc_threshold":1800}</script><script data-name="wpr-wpr-beacon" src='http://example.org/wp-content/plugins/wp-rocket/assets/js/wpr-beacon.min.js' async></script></body>
</html>
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

$html_input = file_get_contents(__DIR__ . '/HTML/input.html');
$html_input_without_closing_body_tag = file_get_contents(__DIR__ . '/HTML/no_closing_body_tag_input.html');
$html_input_without_closing_body_tag_output = file_get_contents(__DIR__ . '/HTML/no_closing_body_tag_output.html');
$html_with_double_body = file_get_contents(__DIR__ . '/HTML/double_body_tag.html');
$html_with_double_body_output = file_get_contents(__DIR__ . '/HTML/output_double_body_tag.html');
$html_output = file_get_contents(__DIR__ . '/HTML/output.html');
Expand Down Expand Up @@ -629,5 +631,17 @@
],
'expected' => $html_with_double_body_output,
],
'shouldAddBeaconWithoutClosingBodyTag' => [
'config' => [
'html' => $html_input_without_closing_body_tag,
'atf' => [
'row' => null,
],
'lrc' => [
'row' => null,
],
],
'expected' => $html_input_without_closing_body_tag_output,
],
],
];

0 comments on commit 61df72e

Please sign in to comment.