Skip to content

Commit

Permalink
replace and test link in TopicListView
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Dec 3, 2024
1 parent a398a5f commit 117e6ff
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 1 deletion.
124 changes: 124 additions & 0 deletions lacommunaute/forum_conversation/tests/__snapshots__/tests_views.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,130 @@
</small>
'''
# ---
# name: TestTopicListView.test_anonymous_content[anonymous_content]
'''
<main class="s-main" id="main" role="main">






<section class="s-title-01 mt-lg-5">
<div class="s-title-01__container container">
<div class="s-title-01__row row">
<div class="s-title-01__col col-12">
<h1>Espace d'échanges</h1>
<h2 class="mt-3">
Questions / réponses entre CIP, travailleurs sociaux et autres accompagnateurs des personnes éloignées de l’emploi (insertion/handicap)
</h2>
</div>
</div>
<div class="s-title-01__row row">
<div class="s-title-01__col col-12 mt-3 mt-lg-5">

</div>
</div>
</div>
</section>
<div id="community"></div>
<section class="s-section mt-0">
<div class="s-section__container container">
<div class="s-section__row row">
<div class="s-section__col col-12">
<div class="c-box">








<div id="topicsarea">


<div class="row align-items-center mb-3">
<div class="col-12 col-sm">
<div class="d-flex align-items-center">
<div class="flex-grow-1" id="topic-list-filter-header">
<span class="h5 m-0">0 question</span>
les plus récentes

</div>
<div>
<span class="fs-sm">Filtrer par :</span>
<button aria-controls="filterTopicsDropdown" aria-expanded="false" aria-haspopup="true" class="btn btn-sm btn-link dropdown-toggle p-0" data-bs-toggle="dropdown" type="button">
les plus récentes
</button>
<div class="dropdown-menu dropdown-menu-end" id="filterTopicsDropdown">
<ul class="list-unstyled">

<li>
<button class="dropdown-item matomo-event" data-matomo-action="filter" data-matomo-category="engagement" data-matomo-option="topics" hx-get="/topics/?filter=ALL" hx-push-url="true" hx-swap="outerHTML" hx-target="#topicsarea" id="filter-ontag-button">les plus récentes</button>
</li>

<li>
<button class="dropdown-item matomo-event" data-matomo-action="filter" data-matomo-category="engagement" data-matomo-option="topics" hx-get="/topics/?filter=NEW" hx-push-url="true" hx-swap="outerHTML" hx-target="#topicsarea" id="filter-ontag-button">en attente de réponse</button>
</li>

<li>
<button class="dropdown-item matomo-event" data-matomo-action="filter" data-matomo-category="engagement" data-matomo-option="topics" hx-get="/topics/?filter=CERTIFIED" hx-push-url="true" hx-swap="outerHTML" hx-target="#topicsarea" id="filter-ontag-button">avec une réponse certifiée</button>
</li>

</ul>
</div>
</div>
</div>
</div>
</div>




<div class="row m-0 p-3">
<div class="col-12 ps-0">

Il n’y a pas de sujets dans cette thématique.

</div>
</div>



</div>
<script nonce="NORMALIZED_CSP_NONCE">
var showmorepostsButtons = document.querySelectorAll('.showmoreposts-button')
showmorepostsButtons.forEach((button) => button.addEventListener('click', function() {
button.classList.add('d-none');
}));
</script>


</div>
</div>
</div>
</div>
</section>

<section class="s-section">
<div class="s-section__container container">
<div class="s-section__row row mb-1 mb-md-3 justify-content-center">
<div class="s-section__col col-12 col-lg-auto">
<a class="btn btn-block btn-ico btn-primary" href="/users/login/?next=/topics/" rel="nofollow">
<i aria-hidden="true" class="ri-login-box-line ri-lg"></i>
<span>Je me connecte pour accéder à toutes mes thématiques</span>
</a>
</div>
</div>
</div>
</section>



</main>
'''
# ---
# name: TestTopicListView.test_clickable_tags[10-query_param1-clickable_tags_page2][clickable_tags_page2]
'<button class="tag bg-info-lighter text-info matomo-event" data-matomo-action="filter" data-matomo-category="engagement" data-matomo-option="topics" hx-get="/topics/?tag=tag&amp;filter=ALL" hx-push-url="true" hx-swap="outerHTML" hx-target="#topicsarea" id="filtertopics-button">tag</button>'
# ---
Expand Down
4 changes: 4 additions & 0 deletions lacommunaute/forum_conversation/tests/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,10 @@ def test_filter_dropdown_with_tags(self, client, db, public_forum_with_topic, to
content = parse_response_to_soup(response, selector="#filterTopicsDropdown")
assert str(content) == snapshot(name="filter_dropdown_with_tags")

def test_anonymous_content(self, client, db, topics_url, snapshot):
response = client.get(topics_url)
assert str(parse_response_to_soup(response, selector="main")) == snapshot(name="anonymous_content")


class TestPosterTemplate:
def test_topic_in_topics_view(self, client, db, topics_url, snapshot):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h2 class="mt-3">
<div class="s-section__container container">
<div class="s-section__row row mb-1 mb-md-3 justify-content-center">
<div class="s-section__col col-12 col-lg-auto">
<a href="{% url 'openid_connect:authorize' %}" class="btn btn-block btn-ico btn-primary">
<a href="{% url 'users:login' %}?next={{ request.path }}" rel="nofollow" class="btn btn-block btn-ico btn-primary">
<i class="ri-login-box-line ri-lg" aria-hidden="true"></i>
<span>Je me connecte pour accéder à toutes mes thématiques</span>
</a>
Expand Down

0 comments on commit 117e6ff

Please sign in to comment.