Comments: Added visual nesting limit, added nesting test

This commit is contained in:
Dan Brown 2023-06-09 11:12:39 +01:00
parent 3b46b92bb9
commit 3bede42121
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
3 changed files with 32 additions and 1 deletions

View File

@ -663,6 +663,12 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {
}
}
.comments-container {
padding-inline: $-xl;
@include smaller-than($m) {
padding-inline: $-xs;
}
}
.comment-box {
border-radius: 4px;
border: 1px solid #DDD;
@ -715,6 +721,10 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {
height: calc(100% - $-m);
}
.comment-branch .comment-branch .comment-branch .comment-branch .comment-thread-indicator {
display: none;
}
#tag-manager .drag-card {
max-width: 500px;
}

View File

@ -34,7 +34,7 @@
</div>
@endif
<div class="px-xl comments-container mb-l print-hidden">
<div class="comments-container mb-l print-hidden">
@include('comments.comments', ['commentTree' => $commentTree, 'page' => $page])
<div class="clearfix"></div>
</div>

View File

@ -114,4 +114,25 @@ class CommentTest extends TestCase
$pageView->assertDontSee($script, false);
$pageView->assertSee('sometextinthecommentupdated');
}
public function test_reply_comments_are_nested()
{
$this->asAdmin();
$page = $this->entities->page();
$this->postJson("/comment/$page->id", ['text' => 'My new comment']);
$this->postJson("/comment/$page->id", ['text' => 'My new comment']);
$respHtml = $this->withHtml($this->get($page->getUrl()));
$respHtml->assertElementCount('.comment-branch', 3);
$respHtml->assertElementNotExists('.comment-branch .comment-branch');
$comment = $page->comments()->first();
$resp = $this->postJson("/comment/$page->id", ['text' => 'My nested comment', 'parent_id' => $comment->local_id]);
$resp->assertStatus(200);
$respHtml = $this->withHtml($this->get($page->getUrl()));
$respHtml->assertElementCount('.comment-branch', 4);
$respHtml->assertElementContains('.comment-branch .comment-branch', 'My nested comment');
}
}