mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-06 16:04:23 +00:00
Add CreateWorkspaceModal and DeleteWorkspaceModal tests
This commit is contained in:
@@ -18,7 +18,8 @@ const CreateWorkspaceModal: React.FC<CreateWorkspaceModalProps> = ({
|
||||
useModalContext();
|
||||
|
||||
const handleSubmit = async (): Promise<void> => {
|
||||
if (!name.trim()) {
|
||||
const trimmedName = name.trim();
|
||||
if (!trimmedName) {
|
||||
notifications.show({
|
||||
title: 'Error',
|
||||
message: 'Workspace name is required',
|
||||
@@ -29,7 +30,7 @@ const CreateWorkspaceModal: React.FC<CreateWorkspaceModalProps> = ({
|
||||
|
||||
setLoading(true);
|
||||
try {
|
||||
const workspace = await createWorkspace(name);
|
||||
const workspace = await createWorkspace(trimmedName);
|
||||
notifications.show({
|
||||
title: 'Success',
|
||||
message: 'Workspace created successfully',
|
||||
@@ -61,6 +62,7 @@ const CreateWorkspaceModal: React.FC<CreateWorkspaceModalProps> = ({
|
||||
>
|
||||
<Box maw={400} mx="auto">
|
||||
<TextInput
|
||||
type="text"
|
||||
label="Workspace Name"
|
||||
placeholder="Enter workspace name"
|
||||
data-testid="workspace-name-input"
|
||||
@@ -80,7 +82,7 @@ const CreateWorkspaceModal: React.FC<CreateWorkspaceModalProps> = ({
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => void handleSubmit}
|
||||
onClick={() => void handleSubmit()}
|
||||
loading={loading}
|
||||
data-testid="confirm-create-workspace-button"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user