fix: resolve review blockers for comments redesign
- Fix context key mismatch in _render_htmx_success ('reply' vs 'comment')
- Update OOB swap selector to match new sibling relationship for replies container
- Update HTMX reply tests to verify correct OOB selector and content rendering
- Fix variable naming in _reply.html to match parent context
This commit is contained in:
@@ -132,12 +132,13 @@ def test_htmx_reply_returns_oob_reply_when_approved(client, _article, approved_c
|
||||
)
|
||||
content = resp.content.decode()
|
||||
assert resp.status_code == 200
|
||||
# OOB targets the parent's replies-container
|
||||
assert f"#comment-{approved_comment.id}" in content
|
||||
assert "hx-swap-oob" in content
|
||||
# Reply uses compact markup (no nested reply form)
|
||||
assert "Reply posted!" in content
|
||||
# OOB targets the sibling .replies-container of the parent comment article
|
||||
assert f'hx-swap-oob="beforeend:#comment-{approved_comment.id} ~ .replies-container"' in content
|
||||
# Verify content is rendered (not empty due to context mismatch)
|
||||
assert "Replier" in content
|
||||
assert "Nice reply" in content
|
||||
reply = Comment.objects.exclude(pk=approved_comment.pk).get()
|
||||
assert f"comment-{reply.id}" in content
|
||||
assert reply.parent_id == approved_comment.id
|
||||
assert reply.is_approved is True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user