Skip to content

Commit

Permalink
fix: fix wg anchor tags (case-sensitive) (#7995)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
microamp authored Oct 2, 2024
1 parent b34bbe5 commit 364dec3
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
6 changes: 6 additions & 0 deletions ietf/group/tests_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ def test_active_groups(self):
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)
Expand Down
14 changes: 14 additions & 0 deletions ietf/iesg/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ def test_agenda(self):

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))
Expand All @@ -412,6 +414,18 @@ def test_agenda(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/group/active_areas.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h1>Areas</h1>
{% 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>
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/iesg/agenda_charter.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion ietf/templates/iesg/agenda_doc.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 364dec3

Please sign in to comment.