test: add company settings selectors

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta 2026-03-30 13:17:51 -05:00
parent 88e742a129
commit d7d01e9819
2 changed files with 14 additions and 3 deletions

View file

@ -105,11 +105,13 @@ export function ToggleField({
hint, hint,
checked, checked,
onChange, onChange,
toggleTestId,
}: { }: {
label: string; label: string;
hint?: string; hint?: string;
checked: boolean; checked: boolean;
onChange: (v: boolean) => void; onChange: (v: boolean) => void;
toggleTestId?: string;
}) { }) {
return ( return (
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
@ -119,6 +121,8 @@ export function ToggleField({
</div> </div>
<button <button
data-slot="toggle" data-slot="toggle"
data-testid={toggleTestId}
type="button"
className={cn( className={cn(
"relative inline-flex h-5 w-9 items-center rounded-full transition-colors", "relative inline-flex h-5 w-9 items-center rounded-full transition-colors",
checked ? "bg-green-600" : "bg-muted" checked ? "bg-green-600" : "bg-muted"

View file

@ -377,7 +377,7 @@ export function CompanySettings() {
)} )}
{/* Hiring */} {/* Hiring */}
<div className="space-y-4"> <div className="space-y-4" data-testid="company-settings-team-section">
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wide"> <div className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
Hiring Hiring
</div> </div>
@ -387,12 +387,13 @@ export function CompanySettings() {
hint="New agent hires stay pending until approved by board." hint="New agent hires stay pending until approved by board."
checked={!!selectedCompany.requireBoardApprovalForNewAgents} checked={!!selectedCompany.requireBoardApprovalForNewAgents}
onChange={(v) => settingsMutation.mutate(v)} onChange={(v) => settingsMutation.mutate(v)}
toggleTestId="company-settings-team-approval-toggle"
/> />
</div> </div>
</div> </div>
{/* Invites */} {/* Invites */}
<div className="space-y-4"> <div className="space-y-4" data-testid="company-settings-invites-section">
<div className="text-xs font-medium text-muted-foreground uppercase tracking-wide"> <div className="text-xs font-medium text-muted-foreground uppercase tracking-wide">
Invites Invites
</div> </div>
@ -405,6 +406,7 @@ export function CompanySettings() {
</div> </div>
<div className="flex flex-wrap items-center gap-2"> <div className="flex flex-wrap items-center gap-2">
<Button <Button
data-testid="company-settings-invites-generate-button"
size="sm" size="sm"
onClick={() => inviteMutation.mutate()} onClick={() => inviteMutation.mutate()}
disabled={inviteMutation.isPending} disabled={inviteMutation.isPending}
@ -418,7 +420,10 @@ export function CompanySettings() {
<p className="text-sm text-destructive">{inviteError}</p> <p className="text-sm text-destructive">{inviteError}</p>
)} )}
{inviteSnippet && ( {inviteSnippet && (
<div className="rounded-md border border-border bg-muted/30 p-2"> <div
className="rounded-md border border-border bg-muted/30 p-2"
data-testid="company-settings-invites-snippet"
>
<div className="flex items-center justify-between gap-2"> <div className="flex items-center justify-between gap-2">
<div className="text-xs text-muted-foreground"> <div className="text-xs text-muted-foreground">
OpenClaw Invite Prompt OpenClaw Invite Prompt
@ -435,12 +440,14 @@ export function CompanySettings() {
</div> </div>
<div className="mt-1 space-y-1.5"> <div className="mt-1 space-y-1.5">
<textarea <textarea
data-testid="company-settings-invites-snippet-textarea"
className="h-[28rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none" className="h-[28rem] w-full rounded-md border border-border bg-background px-2 py-1.5 font-mono text-xs outline-none"
value={inviteSnippet} value={inviteSnippet}
readOnly readOnly
/> />
<div className="flex justify-end"> <div className="flex justify-end">
<Button <Button
data-testid="company-settings-invites-copy-button"
size="sm" size="sm"
variant="ghost" variant="ghost"
onClick={async () => { onClick={async () => {