Skip to content

Commit

Permalink
add current filter being displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Oct 9, 2024
1 parent b18dd0d commit d6d8150
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,38 @@
</div>
'''
# ---
# name: TestTopicListView.test_queryset_on_filter[ALL-<lambda>-None][ALL-tagged_topics]
'''
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">2 questions</span>
les plus récentes

</div>
'''
# ---
# name: TestTopicListView.test_queryset_on_filter[CERTIFIED-<lambda>-<lambda>][CERTIFIED-tagged_topics]
'''
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">1 question</span>
avec une réponse certifiée

</div>
'''
# ---
# name: TestTopicListView.test_queryset_on_filter[NEW-<lambda>-<lambda>][NEW-tagged_topics]
'''
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">2 questions</span>
en attente de réponse

</div>
'''
# ---
# name: TestTopicListView.test_queryset_on_tag[-<lambda>-None][-tagged_topics]
'''
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">2 questions</span>
les plus récentes

</div>
'''
Expand All @@ -228,6 +256,7 @@
'''
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">1 question</span>
les plus récentes

<span class="fs-sm">
sous l'étiquette
Expand All @@ -243,6 +272,7 @@
'''
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">2 questions</span>
les plus récentes

<span class="fs-sm">
sous l'étiquette
Expand Down
4 changes: 3 additions & 1 deletion lacommunaute/forum_conversation/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def test_pagination(self, client, db, public_forum_with_topic, more_topics, pagi
],
)
def test_queryset_on_filter(
self, client, db, public_forum_with_topic, topics_url, filter, expected_topic, unexpected_topic
self, client, db, public_forum_with_topic, topics_url, filter, expected_topic, unexpected_topic, snapshot
):
expected_topic = expected_topic(public_forum_with_topic)
if unexpected_topic:
Expand All @@ -899,6 +899,8 @@ def test_queryset_on_filter(
assert unexpected_topic not in response.context["topics"]
if filter == "CERTIFIED":
assert expected_topic.certified_post.post.content.raw[:100] in response.content.decode()
content = parse_response_to_soup(response, selector="#topic-list-filter-header")
assert str(content) == snapshot(name=f"{filter}-tagged_topics")

@pytest.mark.parametrize(
"tag,expected_topic,unexpected_topic",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<div class="d-flex align-items-center">
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">{{ paginator.count }} question{{ paginator.count|pluralizefr }}</span>
{% if active_filter.name != filters.0.1 %}{{ active_filter.label|lower }}{% endif %}
{% if active_tag %}
<span class="fs-sm">
sous l'étiquette
Expand Down

0 comments on commit d6d8150

Please sign in to comment.