🐛 Fix token create not disabled when creating token without value

This commit is contained in:
Florian Schroedl
2025-08-29 11:27:29 +02:00
committed by Andrés Moya
parent fc5e4a821b
commit 2479a06f9a
2 changed files with 30 additions and 1 deletions

View File

@@ -404,6 +404,35 @@ test.describe("Tokens: Tokens Tab", () => {
await expect(tokensTabPanel.getByLabel("color.dark.primary")).toBeEnabled(); await expect(tokensTabPanel.getByLabel("color.dark.primary")).toBeEnabled();
}); });
test("User cant create regular token with value missing", async ({
page,
}) => {
const { tokensUpdateCreateModal } = await setupEmptyTokensFile(page);
const tokensTabPanel = page.getByRole("tabpanel", { name: "tokens" });
await tokensTabPanel
.getByRole("button", { name: "Add Token: Color" })
.click();
await expect(tokensUpdateCreateModal).toBeVisible();
const nameField = tokensUpdateCreateModal.getByLabel("Name");
const valueField = tokensUpdateCreateModal.getByLabel("Value");
const submitButton = tokensUpdateCreateModal.getByRole("button", {
name: "Save",
});
// Initially submit button should be disabled
await expect(submitButton).toBeDisabled();
// Fill in name but leave value empty
await nameField.click();
await nameField.fill("color.primary");
// Submit button should remain disabled when value is empty
await expect(submitButton).toBeDisabled();
});
test("User changes color token color while keeping custom color space", async ({ test("User changes color token color while keeping custom color space", async ({
page, page,
}) => { }) => {

View File

@@ -404,7 +404,7 @@ custom-input-token-value-props: Custom props passed to the custom-input-token-va
(on-update-value-debounced next-value))) (on-update-value-debounced next-value)))
value-error? (seq (:errors token-resolve-result)) value-error? (seq (:errors token-resolve-result))
valid-value-field? (not value-error?) valid-value-field? (and token-resolve-result (not value-error?))
;; Description ;; Description
description-ref (mf/use-var (:description token)) description-ref (mf/use-var (:description token))