Skip to content

Commit 5200192

Browse files
authored
fix: only show "cannot edit default" on default workspace #308
1 parent 40f86a5 commit 5200192

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/features/workspace/components/__tests__/workspace-name.test.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,15 @@ test("can't rename active workspace", async () => {
5656
});
5757

5858
test("can't rename archived workspace", async () => {
59-
const { getByRole } = render(
59+
const { getByRole, queryByText } = render(
6060
<WorkspaceName workspaceName="foo" isArchived={true} />,
6161
);
6262

6363
expect(getByRole("textbox", { name: /workspace name/i })).toBeDisabled();
6464
expect(getByRole("button", { name: /save/i })).toBeDisabled();
65+
expect(
66+
queryByText(/cannot rename the default workspace/i),
67+
).not.toBeInTheDocument();
6568
});
6669

6770
test("can't rename default workspace", async () => {

src/features/workspace/components/workspace-name.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ export function WorkspaceName({
7070
<FormButtons
7171
isPending={isPending}
7272
formErrorMessage={errorMsg}
73-
formSideNote="Cannot rename the default workspace"
73+
formSideNote={
74+
isDefault ? "Cannot rename the default workspace" : undefined
75+
}
7476
formState={formState}
7577
canSubmit={!isArchived}
7678
/>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy