mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
🐛 Fix token create not disabled when creating token without value
This commit is contained in:
committed by
Andrés Moya
parent
fc5e4a821b
commit
2479a06f9a
@@ -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,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -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))
|
||||||
|
|||||||
Reference in New Issue
Block a user