Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/messages/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"state_enabled": "Enabled",
"state_configured": "Configured",
"state_not_configured": "Not configured",
"state_unavailable": "Unavailable",
"state_smtp_not_configured": "SMTP configuration has not been completed by the administrator.",
"state_smtp_not_configured_admin": "SMTP not configured. Please configure SMTP to send enrollment details by email.",
"state_step": "Step {step}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
&.disabled {
--color: var(--fg-critical);
}

&.unavailable {
--color: var(--fg-attention);
}
}

& > .separator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const FactorRow = ({
>
{smtpDisabled ? (
<>
<p className="status disabled">{m.state_not_configured()}</p>
<p className="status unavailable">{m.state_unavailable()}</p>
<span className="separator" />
<p>{m.state_smtp_not_configured()}</p>
</>
Expand All @@ -47,15 +47,15 @@ export const FactorRow = ({
<p>{m.profile_auth_card_passkey_usage_web()}</p>
<span className="separator" />
<p>{m.profile_auth_card_passkey_usage_vpn()}</p>
{isDefault && (
<Badge
variant="success"
size="compact"
text={m.profile_auth_card_default_method()}
/>
)}
</>
)}
{isDefault && (
<Badge
variant="success"
size="compact"
text={m.profile_auth_card_default_method()}
/>
)}
</AuthCardRow>
);
};
24 changes: 24 additions & 0 deletions web/tests/profile-factor-row.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { render, screen, within } from '@testing-library/react';
import { describe, expect, it } from 'vitest';
import { FactorRow } from '../src/pages/user-profile/UserProfilePage/tabs/ProfileDetailsTab/components/ProfileAuthCard/components/FactorRow/FactorRow';

describe('FactorRow with SMTP not configured', () => {
it('shows a single Unavailable label and keeps the Default badge', () => {
render(
<FactorRow
icon="mail"
title="Email"
enabled
isDefault
smtpDisabled
testId="email-codes-row"
/>,
);

const row = within(screen.getByTestId('email-codes-row'));
expect(row.getByText('Unavailable')).toBeInTheDocument();
expect(row.getByText('Default method')).toBeInTheDocument();
expect(row.queryByText('Not configured')).not.toBeInTheDocument();
expect(row.queryByText('Enabled')).not.toBeInTheDocument();
});
});
Loading