]> BookStack Code Mirror - bookstack/blob - tests/Unit/PageRepoTest.php
Added locale and text direction to html templates
[bookstack] / tests / Unit / PageRepoTest.php
1 <?php
2 namespace Tests;
3
4 use BookStack\Entities\Repos\PageRepo;
5
6 class PageRepoTest extends TestCase
7 {
8     /**
9      * @var PageRepo $pageRepo
10      */
11     protected $pageRepo;
12
13     protected function setUp()
14     {
15         parent::setUp();
16         $this->pageRepo = app()->make(PageRepo::class);
17     }
18
19     public function test_get_page_nav_does_not_show_empty_titles()
20     {
21         $content = '<h1 id="testa">Hello</h1><h2 id="testb">&nbsp;</h2><h3 id="testc"></h3>';
22         $navMap = $this->pageRepo->getPageNav($content);
23
24         $this->assertCount(1, $navMap);
25         $this->assertArraySubset([
26             'nodeName' => 'h1',
27             'link' => '#testa',
28             'text' => 'Hello'
29         ], $navMap[0]);
30     }
31
32 }