Skip to content

Commit ae3b9cb

Browse files
committed
test(theme): update field-group tests for targeted control class selectors
1 parent a4e2ba3 commit ae3b9cb

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

theme/src/recipes/field-group/useFieldGroupRecipe.test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ describe("useFieldGroupRecipe", () => {
144144
});
145145

146146
describe("seam selectors", () => {
147+
const C = `:where(.input, .textarea, .select, .button, .dropdown)`;
148+
const K = `:is(.input, .textarea, .select, .button, .dropdown)`;
149+
147150
it("flattens horizontal seams and grows fields", () => {
148151
const s = createInstance();
149152
useFieldGroupRecipe(s);
@@ -152,10 +155,10 @@ describe("useFieldGroupRecipe", () => {
152155
expect(horizontal).toBeDefined();
153156

154157
expect(
155-
findChildRule(horizontal, "& > *:not(:last-child)")?.declarations,
158+
findChildRule(horizontal, `& > ${C}:has(~ ${K})`)?.declarations,
156159
).toMatchObject({ borderRightWidth: "0" });
157160
expect(
158-
findChildRule(horizontal, "& > *:not(:first-child)")?.declarations,
161+
findChildRule(horizontal, `& > ${C} ~ ${K}`)?.declarations,
159162
).toMatchObject({ borderTopLeftRadius: "0" });
160163

161164
for (const query of ["& > .input", "& > .select", "& > .textarea"]) {
@@ -174,10 +177,10 @@ describe("useFieldGroupRecipe", () => {
174177
expect(vertical).toBeDefined();
175178

176179
expect(
177-
findChildRule(vertical, "& > *:not(:last-child)")?.declarations,
180+
findChildRule(vertical, `& > ${C}:has(~ ${K})`)?.declarations,
178181
).toMatchObject({ borderBottomWidth: "0" });
179182
expect(
180-
findChildRule(vertical, "& > *:not(:first-child)")?.declarations,
183+
findChildRule(vertical, `& > ${C} ~ ${K}`)?.declarations,
181184
).toMatchObject({ borderTopLeftRadius: "0" });
182185
});
183186

0 commit comments

Comments
 (0)