1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Merge pull request #4921 from BookStackApp/v24-02

v23.02.3 changes
This commit is contained in:
Dan Brown
2024-04-05 15:21:05 +01:00
committed by GitHub
8 changed files with 38 additions and 9 deletions

View File

@@ -266,8 +266,8 @@ class BookTest extends TestCase
{
$book = $this->entities->book();
$input = '<h1>Test</h1><p id="abc" href="beans">Content<a href="#cat" data-a="b">a</a><section>Hello</section></p>';
$expected = '<p>Content<a href="#cat">a</a></p>';
$input = '<h1>Test</h1><p id="abc" href="beans">Content<a href="#cat" target="_blank" data-a="b">a</a><section>Hello</section></p>';
$expected = '<p>Content<a href="#cat" target="_blank">a</a></p>';
$this->asEditor()->put($book->getUrl(), [
'name' => $book->name,

View File

@@ -271,7 +271,31 @@ class ReferencesTest extends TestCase
}
}
protected function createReference(Model $from, Model $to)
public function test_reference_from_deleted_item_does_not_count_or_show_in_references_page()
{
$page = $this->entities->page();
$referencingPageA = $this->entities->page();
$referencingPageB = $this->entities->page();
$this->asEditor();
$this->createReference($referencingPageA, $page);
$this->createReference($referencingPageB, $page);
$resp = $this->get($page->getUrl());
$resp->assertSee('Referenced by 2 items');
$this->delete($referencingPageA->getUrl());
$resp = $this->get($page->getUrl());
$resp->assertSee('Referenced by 1 item');
$resp = $this->get($page->getUrl('/references'));
$resp->assertOk();
$resp->assertSee($referencingPageB->getUrl());
$resp->assertDontSee($referencingPageA->getUrl());
}
protected function createReference(Model $from, Model $to): void
{
(new Reference())->forceFill([
'from_type' => $from->getMorphClass(),