Skip to content

Commit 690f40b

Browse files
committed
test: Add test for relativeSelector error
1 parent 1c1f7f2 commit 690f40b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/api.ts

+7
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,13 @@ describe("API", () => {
108108
expect(() => CSSselect.compile("::after")).toThrow("not supported");
109109
});
110110

111+
it("should throw an error if encountering a traversal-first selector with relative selectors disabled", () =>
112+
expect(() =>
113+
CSSselect.compile("> p", { relativeSelector: false })
114+
).toThrow(
115+
"Relative selectors are not allowed when the `relativeSelector` option is disabled"
116+
));
117+
111118
it("should throw with a column combinator", () => {
112119
expect(() => CSSselect.compile("foo || bar")).toThrow(notYet);
113120
});

0 commit comments

Comments
 (0)