mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 03:36:48 +00:00
fix(instances): the image, network and template selects of the create page have names
Three selects of the VM create page had no accessible name. TomSelect points the label of a select it enhances at its own input, so the network select lost its label and the image select never had one; the template select sits beside the template pool's label with none of its own. Each now has an aria-label (Images, Networks, Template), which TomSelect also copies to its input for the image select.
This commit is contained in:
parent
96141c3ef7
commit
ce7c772aae
2 changed files with 12 additions and 3 deletions
|
|
@ -446,7 +446,7 @@
|
|||
</select>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-select" id="image-control" name="image-control" multiple="multiple">
|
||||
<select class="form-select" id="image-control" name="image-control" multiple="multiple" aria-label="{% trans "Images" %}">
|
||||
<!-- populated from javascript -->
|
||||
</select>
|
||||
</div>
|
||||
|
|
@ -465,7 +465,7 @@
|
|||
</template>
|
||||
<input id="networks" type="hidden" name="networks" value=""/>
|
||||
<input id="custom_mac" type="hidden" name="mac" value=""/>
|
||||
<select class="form-select" id="network-control" name="network-control" multiple="multiple">
|
||||
<select class="form-select" id="network-control" name="network-control" multiple="multiple" aria-label="{% trans "Networks" %}">
|
||||
{% for network in networks %}
|
||||
<option value="{{ network }}">{{ network }}</option>
|
||||
{% endfor %}
|
||||
|
|
@ -707,7 +707,7 @@
|
|||
</select>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<select class="form-select{{ template_form.template|invalid }}" id="template" name="template" disabled
|
||||
<select class="form-select{{ template_form.template|invalid }}" id="template" name="template" disabled aria-label="{% trans "Template" %}"
|
||||
{% error_attrs template_form.template "template" %}>
|
||||
<!-- populated from javascript -->
|
||||
</select>
|
||||
|
|
|
|||
|
|
@ -139,6 +139,15 @@ console.log(JSON.stringify([field("#networks").value, field("#custom_mac").value
|
|||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
return json.loads(result.stdout)
|
||||
|
||||
def test_the_selects_without_a_label_of_their_own_are_named(self):
|
||||
# TomSelect points the label of a select it enhances at its own
|
||||
# input; the template select sits beside the template pool's label
|
||||
_, page = self.page()
|
||||
page = html.fromstring(page)
|
||||
for select in ("image-control", "network-control", "template"):
|
||||
with self.subTest(select=select):
|
||||
self.assertTrue(page.get_element_by_id(select).get("aria-label"))
|
||||
|
||||
def test_a_mac_per_nic_fits_the_form(self):
|
||||
macs = ",".join(f"52:54:00:00:00:{n:02x}" for n in range(8))
|
||||
self.assertEqual(NewVMForm.base_fields["mac"].clean(macs), macs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue