]> BookStack Code Mirror - bookstack/blobdiff - tests/Entity/PageContentTest.php
respective book and chapter structure added.
[bookstack] / tests / Entity / PageContentTest.php
index 28897c14d2f20fd8dd6c1d9761afe1ad093500c1..23a38b5735ba83c8c79ae985bf150e3008d4dec5 100644 (file)
@@ -469,6 +469,20 @@ class PageContentTest extends TestCase
         ], $navMap[2]);
     }
 
+    public function test_get_page_nav_respects_non_breaking_spaces()
+    {
+        $content = '<h1 id="testa">Hello&nbsp;There</h1>';
+        $pageContent = new PageContent(new Page(['html' => $content]));
+        $navMap = $pageContent->getNavigation($content);
+
+        $this->assertEquals([
+            'nodeName' => 'h1',
+            'link'     => '#testa',
+            'text'     => 'Hello There',
+            'level'    => 1,
+        ], $navMap[0]);
+    }
+
     public function test_page_text_decodes_html_entities()
     {
         $page = $this->entities->page();