1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 09:26:03 +00:00

fix(tags): sixth audit: the tag box tells its rule, trims a paste; clear keeps the focus

- A name typed or pasted into the tag box that cannot be a tag shows the
  rule (letters a-z, digits, dots, dashes, underscores; at most 12
  characters) instead of nothing; the spaces a paste brings are dropped;
  "constructor" is no longer taken for a tag there is.
- "Clear the filters" hides with the message it is in: the search box takes
  the focus.
This commit is contained in:
catborise 2026-11-19 10:03:50 +03:00
parent bc1894e4d8
commit f6b1ee8985
9 changed files with 74 additions and 36 deletions

View file

@ -150,7 +150,7 @@ function run(elements, stored) {
return listeners.click;
}
const listPage = () => ({
filter: {value: "", hasAttribute: () => false, addEventListener() {}},
filter: {value: "", hasAttribute: () => false, addEventListener() {}, focus() { this.focused = true; }},
"state-filter": {value: "", addEventListener() {}},
"state-pills": pillRow(["", "Active", "Off"]),
"tag-filter": {value: ""},
@ -182,6 +182,15 @@ const listPage = () => ({
assert.strictEqual(focused, "plain");
}
// "Clear the filters" hides with the message it is in: the search box takes the focus
{
const elements = listPage();
elements["clear-filters"] = {addEventListener: (name, fn) => { elements["clear-filters"].click = fn; }};
run(elements, {"VMs_filter_tag": "prod"});
elements["clear-filters"].click();
assert.deepStrictEqual([elements["tag-filter"].value, elements.filter.focused], ["", true]);
}
// a kept tag no pill has any longer is forgotten: made again later, it is not chosen by itself
{
const stored = {"VMs_filter_tag": "gone"};