feat: redesign Exams List page to show submitted custom exams
- Added Custom Exams tab showing all exams from Generation page - Displays title, module badges, duration, and status - Added Create Exam button - Kept Exam Sessions tab for institutional sessions - Search filters across exams Made-with: Cursor
This commit is contained in:
64
node_modules/@radix-ui/react-alert-dialog/src/alert-dialog.test.tsx
generated
vendored
Normal file
64
node_modules/@radix-ui/react-alert-dialog/src/alert-dialog.test.tsx
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
import React from 'react';
|
||||
import { axe } from 'vitest-axe';
|
||||
import type { RenderResult } from '@testing-library/react';
|
||||
import { cleanup, render, fireEvent } from '@testing-library/react';
|
||||
import * as AlertDialog from './alert-dialog';
|
||||
import { afterEach, describe, it, beforeEach, expect } from 'vitest';
|
||||
|
||||
const OPEN_TEXT = 'Open';
|
||||
const CANCEL_TEXT = 'Cancel';
|
||||
const ACTION_TEXT = 'Do it';
|
||||
const TITLE_TEXT = 'Warning';
|
||||
const DESC_TEXT = 'This is a warning';
|
||||
const OVERLAY_TEST_ID = 'test-overlay';
|
||||
|
||||
const DialogTest = (props: React.ComponentProps<typeof AlertDialog.Root>) => (
|
||||
<AlertDialog.Root {...props}>
|
||||
<AlertDialog.Trigger>{OPEN_TEXT}</AlertDialog.Trigger>
|
||||
<AlertDialog.Overlay data-testid={OVERLAY_TEST_ID} />
|
||||
<AlertDialog.Content>
|
||||
<AlertDialog.Title>{TITLE_TEXT}</AlertDialog.Title>
|
||||
<AlertDialog.Description>{DESC_TEXT}</AlertDialog.Description>
|
||||
<AlertDialog.Cancel>{CANCEL_TEXT}</AlertDialog.Cancel>
|
||||
<AlertDialog.Action>{ACTION_TEXT}</AlertDialog.Action>
|
||||
</AlertDialog.Content>
|
||||
</AlertDialog.Root>
|
||||
);
|
||||
|
||||
describe('given a default Dialog', () => {
|
||||
let rendered: RenderResult;
|
||||
let title: HTMLElement;
|
||||
let trigger: HTMLElement;
|
||||
let cancelButton: HTMLElement;
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
beforeEach(() => {
|
||||
rendered = render(<DialogTest />);
|
||||
trigger = rendered.getByText(OPEN_TEXT);
|
||||
});
|
||||
|
||||
it('should have no accessibility violations in default state', async () => {
|
||||
expect(await axe(rendered.container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
describe('after clicking the trigger', () => {
|
||||
beforeEach(() => {
|
||||
fireEvent.click(trigger);
|
||||
title = rendered.getByText(TITLE_TEXT);
|
||||
cancelButton = rendered.getByText(CANCEL_TEXT);
|
||||
});
|
||||
|
||||
it('should open the content', () => {
|
||||
expect(title).toBeVisible();
|
||||
});
|
||||
|
||||
it('should have no accessibility violations when open', async () => {
|
||||
expect(await axe(rendered.container)).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it('should focus the cancel button', () => {
|
||||
expect(cancelButton).toHaveFocus();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user