From 56f234d1ee046a84da163aaaa5048a2463dbabb1 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Thu, 27 Apr 2023 15:52:16 +0100 Subject: [PATCH] Review of #4192, Fixed formatting and added test --- app/Entities/Tools/PageContent.php | 8 ++++---- tests/Entity/PageContentTest.php | 11 +++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/app/Entities/Tools/PageContent.php b/app/Entities/Tools/PageContent.php index 67f3ea338..a12a19c66 100644 --- a/app/Entities/Tools/PageContent.php +++ b/app/Entities/Tools/PageContent.php @@ -303,10 +303,10 @@ class PageContent if ($blankIncludes) { $content = $this->blankPageIncludes($content); - } else { - for ($includeDepth = 0; $includeDepth <= 3; $includeDepth++) { - $content = $this->parsePageIncludes($content); - } + } else { + for ($includeDepth = 0; $includeDepth <= 3; $includeDepth++) { + $content = $this->parsePageIncludes($content); + } } return $content; diff --git a/tests/Entity/PageContentTest.php b/tests/Entity/PageContentTest.php index 6d6224abf..cf67e27e2 100644 --- a/tests/Entity/PageContentTest.php +++ b/tests/Entity/PageContentTest.php @@ -108,6 +108,17 @@ class PageContentTest extends TestCase $htmlContent->assertSee('my cat is awesome and scratchy'); } + public function test_page_includes_can_be_nested_up_to_three_times() + { + $page = $this->entities->page(); + $tag = "{{@{$page->id}#bkmrk-test}}"; + $page->html = '

Hello Barry ' . $tag . '

'; + $page->save(); + + $pageResp = $this->asEditor()->get($page->getUrl()); + $this->withHtml($pageResp)->assertElementContains('#bkmrk-test', 'Hello Barry Hello Barry Hello Barry ' . $tag); + } + public function test_page_content_scripts_removed_by_default() { $this->asEditor();