mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-07 08:24:27 +00:00
Add data-testid attributes for improved testing in modals
This commit is contained in:
@@ -54,12 +54,14 @@ const CreateUserModal: React.FC<CreateUserModalProps> = ({
|
||||
label="Email"
|
||||
required
|
||||
value={email}
|
||||
data-testid="create-user-email-input"
|
||||
onChange={(e) => setEmail(e.currentTarget.value)}
|
||||
placeholder="user@example.com"
|
||||
/>
|
||||
<TextInput
|
||||
label="Display Name"
|
||||
value={displayName}
|
||||
data-testid="create-user-display-name-input"
|
||||
onChange={(e) => setDisplayName(e.currentTarget.value)}
|
||||
placeholder="John Doe"
|
||||
/>
|
||||
@@ -67,6 +69,7 @@ const CreateUserModal: React.FC<CreateUserModalProps> = ({
|
||||
label="Password"
|
||||
required
|
||||
value={password}
|
||||
data-testid="create-user-password-input"
|
||||
onChange={(e) => setPassword(e.currentTarget.value)}
|
||||
placeholder="Enter password"
|
||||
/>
|
||||
@@ -74,6 +77,7 @@ const CreateUserModal: React.FC<CreateUserModalProps> = ({
|
||||
label="Role"
|
||||
required
|
||||
value={role}
|
||||
data-testid="create-user-role-select"
|
||||
onChange={(value) => value && setRole(value as UserRole)}
|
||||
data={[
|
||||
{ value: UserRole.Admin, label: 'Admin' },
|
||||
@@ -82,10 +86,18 @@ const CreateUserModal: React.FC<CreateUserModalProps> = ({
|
||||
]}
|
||||
/>
|
||||
<Group justify="flex-end" mt="md">
|
||||
<Button variant="default" onClick={onClose}>
|
||||
<Button
|
||||
variant="default"
|
||||
onClick={onClose}
|
||||
data-testid="cancel-create-user-button"
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button onClick={() => void handleSubmit} loading={loading}>
|
||||
<Button
|
||||
onClick={() => void handleSubmit}
|
||||
loading={loading}
|
||||
data-testid="confirm-create-user-button"
|
||||
>
|
||||
Create User
|
||||
</Button>
|
||||
</Group>
|
||||
|
||||
Reference in New Issue
Block a user