test: add data-testid attributes to admin sub-components and modals

This commit is contained in:
2026-04-19 09:28:27 +03:00
parent cbfe6a22be
commit 1846bb3cb3
6 changed files with 26 additions and 12 deletions

View File

@@ -70,7 +70,7 @@ export default function CreateUserModal({ show, onClose, onUserCreated }: Create
const isFormValid = username.trim() && password.length >= 6 && !Object.keys(errors).length;
return (
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40">
<div data-testid="create-user-modal" className="fixed inset-0 z-50 flex items-center justify-center bg-black/40">
<div className="bg-surface border border-slate-800 rounded-lg shadow-xl max-w-sm w-full mx-4">
{/* Header */}
<div className="flex items-center justify-between p-6 border-b border-slate-800">
@@ -93,6 +93,7 @@ export default function CreateUserModal({ show, onClose, onUserCreated }: Create
</label>
<input
id="username"
data-testid="new-user-name"
type="text"
value={username}
onChange={(e) => {
@@ -117,6 +118,7 @@ export default function CreateUserModal({ show, onClose, onUserCreated }: Create
</label>
<input
id="password"
data-testid="new-user-password"
type="password"
value={password}
onChange={(e) => {
@@ -146,6 +148,7 @@ export default function CreateUserModal({ show, onClose, onUserCreated }: Create
</button>
<button
type="submit"
data-testid="create-user-submit"
disabled={!isFormValid || loading}
className="flex-1 px-4 py-2.5 bg-primary text-primary-foreground rounded font-semibold hover:bg-blue-600 transition-colors disabled:opacity-50 flex items-center justify-center gap-2 focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-slate-900 focus-visible:ring-primary focus-visible:outline-none"
>