1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Added content-view body classes generated from tags

Included tests to cover.

Closes #3583
This commit is contained in:
Dan Brown
2022-07-23 18:29:04 +01:00
parent 840a1ea011
commit 975ba4f8d8
11 changed files with 96 additions and 5 deletions

View File

@ -198,9 +198,28 @@ class TagTest extends TestCase
public function test_tag_index_shows_message_on_no_results()
{
/** @var Page $page */
$resp = $this->asEditor()->get('/tags?search=testingval');
$resp->assertSee('No items available');
$resp->assertSee('Tags can be assigned via the page editor sidebar');
}
public function test_tag_classes_visible_on_entities()
{
$this->asEditor();
foreach ($this->getEachEntityType() as $entity) {
$entity->tags()->create(['name' => 'My Super Tag Name', 'value' => 'An-awesome-value']);
$html = $this->withHtml($this->get($entity->getUrl()));
$html->assertElementExists('body.tag-name-mysupertagname.tag-value-anawesomevalue.tag-pair-mysupertagname-anawesomevalue');
}
}
public function test_tag_classes_are_escaped()
{
$page = Page::query()->first();
$page->tags()->create(['name' => '<>']);
$resp = $this->asEditor()->get($page->getUrl());
$resp->assertDontSee('tag-name-<>', false);
$resp->assertSee('tag-name-&lt;&gt;', false);
}
}