mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(computes): the host sections are a breadcrumb again; capacity lines wrap in their card
#241 made the host sections pills: on a desktop they took two lines, unlike the breadcrumb the pages had. computes/host_nav.html is the breadcrumb again, one line at 1200 px and wider, still shared by the eleven host pages: the section's own page is its bold item with aria-current="page", an item page (a pool, a network) links its section in bold with aria-current="true". The capacity lines were kept on one line, made for the Computes table: in the overview's narrower cards a long memory line ran out of its card. They now wrap.
This commit is contained in:
parent
f3a84bba53
commit
ca7678e384
5 changed files with 35 additions and 28 deletions
|
|
@ -11,15 +11,15 @@ class HostNavTestCase(TestCase):
|
|||
def setUp(self):
|
||||
self.compute = Compute.objects.create(name="c", hostname="192.0.2.1", login="u", password="p", type=1)
|
||||
|
||||
def links(self, **context):
|
||||
def items(self, **context):
|
||||
nav = html.fromstring(render_to_string("computes/host_nav.html", {"compute": self.compute, **context}))
|
||||
return {link.text_content().strip(): (link.get("class"), link.get("aria-current")) for link in nav.iter("a")}
|
||||
return {item.text_content().strip(): (item.tag, item.get("aria-current")) for item in nav.xpath("//li/*")}
|
||||
|
||||
def test_the_section_s_own_page_is_the_current_page(self):
|
||||
links = self.links(section="storages")
|
||||
self.assertEqual(len(links), 7)
|
||||
self.assertEqual(links["Storages"], ("nav-link active", "page"))
|
||||
self.assertEqual(links["Overview"], ("nav-link", None))
|
||||
items = self.items(section="storages")
|
||||
self.assertEqual(len(items), 7)
|
||||
self.assertEqual(items["Storages"], ("span", "page"))
|
||||
self.assertEqual(items["Overview"], ("a", None))
|
||||
|
||||
def test_an_item_of_a_section_marks_the_section_without_being_its_page(self):
|
||||
self.assertEqual(self.links(section="networks", detail=True)["Networks"], ("nav-link active", "true"))
|
||||
def test_an_item_of_a_section_links_the_section_as_where_it_is(self):
|
||||
self.assertEqual(self.items(section="networks", detail=True)["Networks"], ("a", "true"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue