mirror of
https://github.com/penpot/penpot.git
synced 2025-07-13 15:07:17 +02:00
🐛 Fix error when there exists a tokens lib with no sets
This commit is contained in:
parent
8f840daa91
commit
4fddf34a73
2 changed files with 20 additions and 3 deletions
|
@ -529,6 +529,14 @@ test.describe("Tokens: Sets Tab", () => {
|
|||
await changeSetInput(sidebar, setName, (finalKey = "Enter"));
|
||||
};
|
||||
|
||||
const assertEmptySetsList = async (el) => {
|
||||
const buttons = await el.getByRole("button").allTextContents();
|
||||
const filteredButtons = buttons.filter(
|
||||
(text) => text === "Create one.",
|
||||
);
|
||||
await expect(filteredButtons.length).toEqual(2); // We assume there are no themes, so we have two "Create one" buttons.
|
||||
};
|
||||
|
||||
const assertSetsList = async (el, sets) => {
|
||||
const buttons = await el.getByRole("button").allTextContents();
|
||||
const filteredButtons = buttons.filter(
|
||||
|
@ -623,6 +631,15 @@ test.describe("Tokens: Sets Tab", () => {
|
|||
"sizes",
|
||||
"small",
|
||||
]);
|
||||
|
||||
// User deletes all sets
|
||||
await tokenThemesSetsSidebar
|
||||
.getByRole("button", { name: "core" })
|
||||
.click({ button: "right" });
|
||||
await expect(tokenContextMenuForSet).toBeVisible();
|
||||
await tokenContextMenuForSet.getByText("Delete").click();
|
||||
|
||||
await assertEmptySetsList(tokenThemesSetsSidebar);
|
||||
});
|
||||
|
||||
test("User can create & edit sets and set groups with an identical name", async ({
|
||||
|
|
|
@ -123,9 +123,9 @@
|
|||
(and selected-token-set-name
|
||||
(not (ctob/get-set tokens-lib selected-token-set-name)))))
|
||||
(let [match (->> (ctob/get-sets tokens-lib)
|
||||
(first)
|
||||
(ctob/get-name))]
|
||||
(st/emit! (dwtl/set-selected-token-set-name match)))))
|
||||
(first))]
|
||||
(when match
|
||||
(st/emit! (dwtl/set-selected-token-set-name (ctob/get-name match)))))))
|
||||
|
||||
[:*
|
||||
[:& token-context-menu]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue