From 364dec3e33cc0df8804d1792584c4ac97336cba6 Mon Sep 17 00:00:00 2001 From: Sangho Na Date: Thu, 3 Oct 2024 11:37:49 +1300 Subject: [PATCH] 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 --- ietf/group/tests_info.py | 6 ++++++ ietf/iesg/tests.py | 14 ++++++++++++++ ietf/templates/group/active_areas.html | 2 +- ietf/templates/iesg/agenda_charter.html | 2 +- ietf/templates/iesg/agenda_doc.html | 2 +- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ietf/group/tests_info.py b/ietf/group/tests_info.py index 561f542f4..95fe9aa2e 100644 --- a/ietf/group/tests_info.py +++ b/ietf/group/tests_info.py @@ -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) diff --git a/ietf/iesg/tests.py b/ietf/iesg/tests.py index 8438cb44d..42e838ebd 100644 --- a/ietf/iesg/tests.py +++ b/ietf/iesg/tests.py @@ -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) diff --git a/ietf/templates/group/active_areas.html b/ietf/templates/group/active_areas.html index 63637889e..8355d13bb 100644 --- a/ietf/templates/group/active_areas.html +++ b/ietf/templates/group/active_areas.html @@ -65,7 +65,7 @@ {% for area in areas %}

{{ area.name }} - ({{ area.acronym|upper }}) + ({{ area.acronym|upper }})

{% if area.description %}

diff --git a/ietf/templates/iesg/agenda_charter.html b/ietf/templates/iesg/agenda_charter.html index 20bd23e06..b4124914d 100644 --- a/ietf/templates/iesg/agenda_charter.html +++ b/ietf/templates/iesg/agenda_charter.html @@ -24,7 +24,7 @@

Area
- + {{ doc.group.parent.acronym|upper }} ({% person_link doc.ad %})
diff --git a/ietf/templates/iesg/agenda_doc.html b/ietf/templates/iesg/agenda_doc.html index ae78d96d6..87051fda2 100644 --- a/ietf/templates/iesg/agenda_doc.html +++ b/ietf/templates/iesg/agenda_doc.html @@ -37,7 +37,7 @@
Token