Per review, use css :has() pseudo class

It saves writing some custom javascript, less code to maintain!
This commit is contained in:
Gaetan Craig-Riou
2025-04-15 13:14:10 +10:00
parent 90ca224680
commit aba6240736
4 changed files with 5 additions and 35 deletions

View File

@@ -13,10 +13,7 @@ describe("TagListInputController", () => {
beforeEach(() => {
document.body.innerHTML = `
<div
data-controller="tag-list-input-component--tag-list-input"
data-tag-list-input-component--tag-list-input-highlight-class-value="changed"
>
<div data-controller="tag-list-input-component--tag-list-input">
<input
value="tag 1,tag 2,tag 3"
data-tag-list-input-component--tag-list-input-target="tagList"
@@ -98,12 +95,6 @@ describe("TagListInputController", () => {
expect(variant_add_tag.value).toBe("");
});
it("higlights the tag list", () => {
const tagList = document.getElementsByClassName("tags")[0];
expect(tagList.classList).toContain("changed");
});
describe("when tag already exist", () => {
beforeEach(() => {
// Trying to add an existing tag
@@ -141,12 +132,6 @@ describe("TagListInputController", () => {
// 1 template + 2 tags
expect(tagList.childElementCount).toBe(3);
});
it("higlights the tag list", () => {
const tagList = document.getElementsByClassName("tags")[0];
expect(tagList.classList).toContain("changed");
});
});
describe("filterInput", () => {