fix: fix wg anchor tags (case-sensitive) (#7995)

* fix: fix wg anchor tags in areas page

* fix: fix wg anchor tags in IESG agenda page

* test: ensure wg anchor tags to be all uppercase

* test: improve tests
This commit is contained in:
Sangho Na 2024-10-03 11:37:49 +13:00 committed by GitHub
parent b34bbe59ad
commit 364dec3e33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 23 additions and 3 deletions

View file

@ -87,6 +87,12 @@ class GroupPagesTests(TestCase):
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
self.assertContains(r, g.acronym)
if t == "area":
q = PyQuery(r.content)
wg_url = urlreverse("ietf.group.views.active_groups", kwargs=dict(group_type="wg"))
href = f"{wg_url}#{g.acronym.upper()}"
self.assertEqual(q(f"h2#id-{g.acronym} a").attr("href"), href)
self.assertEqual(q(f'h2#id-{g.acronym} a[href="{href}"]').text(), f"({g.acronym.upper()})")
url = urlreverse('ietf.group.views.active_groups', kwargs=dict())
r = self.client.get(url)

View file

@ -404,6 +404,8 @@ class IESGAgendaTests(TestCase):
self.assertContains(r, action_items.text)
q = PyQuery(r.content)
for k, d in self.telechat_docs.items():
if d.type_id == "charter":
self.assertContains(r, d.group.name, msg_prefix="%s '%s' not in response" % (k, d.group.name))
@ -412,6 +414,18 @@ class IESGAgendaTests(TestCase):
self.assertContains(r, d.name, msg_prefix="%s '%s' not in response" % (k, d.name))
self.assertContains(r, d.title, msg_prefix="%s '%s' title not in response" % (k, d.title))
if d.type_id in ["charter", "draft"]:
if d.group.parent is None:
continue
wg_url = urlreverse("ietf.group.views.active_groups", kwargs=dict(group_type="wg"))
href = f"{wg_url}#{d.group.parent.acronym.upper()}"
texts = [elem.text.strip() for elem in q(f'a[href="{href}"]')]
self.assertGreater(len(texts), 0)
if d.type_id == "charter":
self.assertTrue(any(t == d.group.parent.acronym.upper() for t in texts))
elif d.type_id == "draft":
self.assertTrue(any(t == f"({d.group.parent.acronym.upper()})" for t in texts))
for i, mi in enumerate(self.mgmt_items, start=1):
s = "6." + str(i)
self.assertContains(r, s, msg_prefix="Section '%s' not in response" % s)

View file

@ -65,7 +65,7 @@
{% for area in areas %}
<h2 class="mt-5" id="id-{{ area.acronym|slugify }}">
{{ area.name }}
<a href="{% url 'ietf.group.views.active_groups' group_type='wg' %}#{{ area.acronym }}">({{ area.acronym|upper }})</a>
<a href="{% url 'ietf.group.views.active_groups' group_type='wg' %}#{{ area.acronym|upper }}">({{ area.acronym|upper }})</a>
</h2>
{% if area.description %}
<p>

View file

@ -24,7 +24,7 @@
<div class="row">
<div class="col-3 text-end fw-bold">Area</div>
<div class="col">
<a href="{% url 'ietf.group.views.active_groups' group_type='wg' %}#{{ doc.group.parent.acronym }}">
<a href="{% url 'ietf.group.views.active_groups' group_type='wg' %}#{{ doc.group.parent.acronym|upper }}">
{{ doc.group.parent.acronym|upper }}</a>
({% person_link doc.ad %})
</div>

View file

@ -37,7 +37,7 @@
<div class="col-3 text-end fw-bold">Token</div>
<div class="col">
{% person_link doc.ad %}
<a href="{% url 'ietf.group.views.active_groups' group_type='wg' %}#{{ doc.group.parent.acronym }}">
<a href="{% url 'ietf.group.views.active_groups' group_type='wg' %}#{{ doc.group.parent.acronym|upper }}">
({{ doc.group.parent.acronym|upper }})
</a>
</div>