Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
import { expect, test } from "vitest";
import {
areInstanceSelectorsEqual,
isDescendantOrSelf,
} from "@webstudio-is/project-build/runtime";
test("compares instance selectors", () => {
expect(areInstanceSelectorsEqual(["child", "body"], ["child", "body"])).toBe(
true
);
expect(areInstanceSelectorsEqual(["child"], ["other"])).toBe(false);
expect(areInstanceSelectorsEqual(undefined, ["child"])).toBe(false);
expect(areInstanceSelectorsEqual(undefined, undefined)).toBe(false);
});
test("is descendant or self", () => {
expect(isDescendantOrSelf(["1", "2", "3"], [])).toBe(true);
expect(isDescendantOrSelf(["1", "2", "3"], ["1", "2", "3"])).toBe(true);
expect(isDescendantOrSelf(["0", "1", "2", "3"], ["1", "2", "3"])).toBe(true);
expect(isDescendantOrSelf(["1", "2", "3"], ["0", "1", "2", "3"])).toBe(false);
expect(
isDescendantOrSelf(
["item-child", "collection:entry-1", "collection", "body", "page-root"],
["collection", "body", "page-root"]
)
).toBe(true);
});