mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-10-27 15:16:53 +09:00
31 lines
955 B
TypeScript
31 lines
955 B
TypeScript
import { describe, expect, test } from "vitest";
|
|
import { getContextMenuSelectedInstanceSelectors } from "./selection";
|
|
|
|
describe("getContextMenuSelectedInstanceSelectors", () => {
|
|
test("preserves selected set when context menu opens on a selected instance", () => {
|
|
const selectedSelectors = [
|
|
["box", "section", "body"],
|
|
["heading", "section", "body"],
|
|
];
|
|
|
|
expect(
|
|
getContextMenuSelectedInstanceSelectors({
|
|
selectedSelectors,
|
|
clickedSelector: ["heading", "section", "body"],
|
|
})
|
|
).toBe(selectedSelectors);
|
|
});
|
|
|
|
test("selects only the clicked instance when context menu opens on an unselected instance", () => {
|
|
expect(
|
|
getContextMenuSelectedInstanceSelectors({
|
|
selectedSelectors: [
|
|
["box", "section", "body"],
|
|
["heading", "section", "body"],
|
|
],
|
|
clickedSelector: ["footer", "body"],
|
|
})
|
|
).toEqual([["footer", "body"]]);
|
|
});
|
|
});
|