fix(client): clarify login form styling
- Add spacing for the session-expired notice and distinguish login inputs. - Assert those surfaces in expired-session light and dark stories.
This commit is contained in:
1 parent
8676d6281c
commit
f2bcbe07b6
3 files changed
+29
-1
No files matched your search
@@ -21,13 +21,30 @@ const meta: Meta<typeof LoginForm> = {
|
||||
export default meta;
|
||||
type Story = StoryObj<typeof LoginForm>;
|
||||
|
||||
async function expectLoginSurfaces(canvasElement: HTMLElement) {
|
||||
const canvas = within(canvasElement);
|
||||
const card = canvasElement.querySelector('section');
|
||||
const notice = canvas.getByText('Your session has expired. Sign in again to continue.');
|
||||
const username = canvas.getByRole('textbox', { name: 'Username' });
|
||||
if (!card) throw new Error('Login card was not rendered.');
|
||||
|
||||
await expect(window.getComputedStyle(notice).marginBottom).not.toBe('0px');
|
||||
await expect(window.getComputedStyle(username).backgroundColor).not.toBe(
|
||||
window.getComputedStyle(card).backgroundColor,
|
||||
);
|
||||
}
|
||||
|
||||
export const Initial: Story = {};
|
||||
|
||||
export const ExpiredSession: Story = { args: { expired: true } };
|
||||
export const ExpiredSession: Story = {
|
||||
args: { expired: true },
|
||||
play: async ({ canvasElement }) => expectLoginSurfaces(canvasElement),
|
||||
};
|
||||
|
||||
export const SignedOut: Story = { args: { signedOut: true } };
|
||||
|
||||
export const DarkTheme: Story = {
|
||||
args: { expired: true },
|
||||
decorators: [
|
||||
(Story) => (
|
||||
<div data-theme="dark" style={{ width: 440, padding: 24, background: 'var(--color-bg)' }}>
|
||||
@@ -35,6 +52,7 @@ export const DarkTheme: Story = {
|
||||
</div>
|
||||
),
|
||||
],
|
||||
play: async ({ canvasElement }) => expectLoginSurfaces(canvasElement),
|
||||
};
|
||||
|
||||
export const NarrowViewport: Story = {
|
||||
|
||||
Reference in new issue
Block a user