From 956b7d44b35d7e030c8c1eafb714dc7b8873d8c4 Mon Sep 17 00:00:00 2001 From: Aaron Francis Date: Sun, 18 Jul 2021 20:11:42 -0500 Subject: [PATCH] Update tests to take new default response into account --- .gitignore | 2 +- src/BlockManager.php | 5 +++-- tests/snapshots/attributes-get-carried-over.html | 4 +--- tests/snapshots/jigsaw-escapes-get-fixed.html | 5 +---- tests/snapshots/non-existent-id.html | 2 +- tests/snapshots/one-component.html | 2 +- tests/snapshots/two-components.html | 4 ++-- 7 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index ab9f022..4913b8e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,4 @@ CVS composer.lock .phpunit.result.cache tests/Site/build_testing/ - +tests/Site/torchlight.php diff --git a/src/BlockManager.php b/src/BlockManager.php index ace3fc1..ca41df1 100644 --- a/src/BlockManager.php +++ b/src/BlockManager.php @@ -74,12 +74,13 @@ protected function renderMarkdownCapturedBlocks() $id = $this->getCapturedGroup('/id="(.+?)"/', $element); $classes = $this->getCapturedGroup('/class="(.+?)"/', $element); - $id = $id ? "id='$id'" : ''; + $id = $id ? " id='$id'" : ''; + // User defined classes + Torchlight classes from the API. $classes = trim("$classes $block->classes"); // Build up a new element. - $html = "
{$block->highlighted}
"; + $html = "
{$block->highlighted}
"; // Finally swap the old element for the new, highlighted one. $contents = str_replace($element, $html, $contents); diff --git a/tests/snapshots/attributes-get-carried-over.html b/tests/snapshots/attributes-get-carried-over.html index 49a9ecd..e9c441d 100644 --- a/tests/snapshots/attributes-get-carried-over.html +++ b/tests/snapshots/attributes-get-carried-over.html @@ -1,7 +1,5 @@

Some text before

-
<?php
-
-echo "hello world";
+
<?php
echo "hello world";

Some text after

diff --git a/tests/snapshots/jigsaw-escapes-get-fixed.html b/tests/snapshots/jigsaw-escapes-get-fixed.html index ed9afe0..102daac 100644 --- a/tests/snapshots/jigsaw-escapes-get-fixed.html +++ b/tests/snapshots/jigsaw-escapes-get-fixed.html @@ -1,8 +1,5 @@

Some text before

-
<?php
-@
-{{
-{!!
+
<?php
@
{{
{!!

Some text after

diff --git a/tests/snapshots/non-existent-id.html b/tests/snapshots/non-existent-id.html index 0d62129..ac70728 100644 --- a/tests/snapshots/non-existent-id.html +++ b/tests/snapshots/non-existent-id.html @@ -1,3 +1,3 @@ -
echo "hello world 1";
+
echo "hello world 1";
An id with no block remains: __torchlight-block-[fake_id]__ \ No newline at end of file diff --git a/tests/snapshots/one-component.html b/tests/snapshots/one-component.html index 09d3345..e3782c9 100644 --- a/tests/snapshots/one-component.html +++ b/tests/snapshots/one-component.html @@ -1 +1 @@ -
echo "hello world 1";
\ No newline at end of file +
echo "hello world 1";
\ No newline at end of file diff --git a/tests/snapshots/two-components.html b/tests/snapshots/two-components.html index bc12a88..9a6123f 100644 --- a/tests/snapshots/two-components.html +++ b/tests/snapshots/two-components.html @@ -1,3 +1,3 @@ -
echo "hello world 1";
+
echo "hello world 1";
-
echo "hello world 2";
\ No newline at end of file +
echo "hello world 2";
\ No newline at end of file