Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMS-428: case detail accessibility #914

Merged
merged 21 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
168a9f6
corrected page header, Case Detail tab name, added div code
amorrow-flexion Sep 13, 2024
9214a64
removed workitems
amorrow-flexion Sep 13, 2024
bdfc4b1
modified tests to accomadate for changed
amorrow-flexion Sep 13, 2024
8e6d687
renamed audit history to Case History
amorrow-flexion Sep 13, 2024
f795ee0
reverted nav link renames
amorrow-flexion Sep 13, 2024
6f05c3d
renamed Basc Info and components to Case Overview
amorrow-flexion Sep 16, 2024
0f8018d
Fixed non-critical Accessibility Issues
fmaddenflx Sep 16, 2024
89687e9
fixed tests related to accessibility updates
amorrow-flexion Sep 17, 2024
1696b1f
Exp - always take user back to original tab
fmaddenflx Sep 17, 2024
7c153b7
Merge pull request #915 from US-Trustee-Program/CAMS-428-case-detail-…
fmaddenflx Sep 17, 2024
b0302cd
initial testing for UseLocationTracker
amorrow-flexion Sep 17, 2024
8815709
100% test coverage on UseLocationTracker hook
fmaddenflx Sep 17, 2024
dd315a0
Test coverage > 96% for CaseDetailHeader.tsx
fmaddenflx Sep 18, 2024
5ede4d6
Fixed a security iss in the location tracker mock
fmaddenflx Sep 18, 2024
0e1c0ae
Hopefully fixed security issues with mock
fmaddenflx Sep 18, 2024
27e7f28
Removed location tracker hook and back links
fmaddenflx Sep 20, 2024
395f892
Added clipboard copy tests
fmaddenflx Sep 20, 2024
dfd761f
moved copyCaseNumber to lib/utils and renamed formatCaseNumber
amorrow-flexion Sep 20, 2024
ce2c573
Added period to caseDetail alert message
fmaddenflx Sep 20, 2024
bc361dd
Added IconButton and CopyButton components
fmaddenflx Sep 20, 2024
c9603fa
Removed stale comment
fmaddenflx Sep 20, 2024
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
85 changes: 44 additions & 41 deletions user-interface/src/case-detail/CaseDetailScreen.scss
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
@import '../styles/theme.scss';
.App {
.body {
.case-detail {
h4 {
margin-block-start: 0;
margin-block-end: 0;

.case-detail {
h4 {
margin-block-start: 0;
margin-block-end: 0;
}

.link-icon {
margin-left: 0.25rem;
vertical-align: middle;
}
.case-card-list {
.case-card {
line-height: 1.5;

h3 {
margin-bottom: 0.5rem;
}

.link-icon {
margin-left: .25rem;
vertical-align: middle;
li.transfer {
margin-bottom: 1rem;
}
.case-card-list {
.case-card {
li.transfer {
margin-bottom: 1rem;
}
.case-detail-item-name {
padding-right: 0.5rem;
}
.transfer-court {
span {
white-space: nowrap;
}
}
}
.case-detail-item-name {
padding-right: .5rem;
}
.assigned-staff-list {
.case-detail-region-id {
padding-bottom: 0.5rem;
}
.individual-assignee {
.vertical-divider {
padding: 0 0.5rem;
}
.transfer-court {
span {
white-space: nowrap;
}
}
ul {
padding-bottom: 0.5rem;
}
.filter-and-search {
.form-field {
padding-bottom: 1.5rem;
}
.docket-summary-facets label {
margin-bottom: 0.5rem;
}
}
}
.assigned-staff-list {
.case-detail-region-id {
padding-bottom: 0.5rem;
}
.individual-assignee {
.vertical-divider {
padding: 0 0.5rem;
}
}
}
ul {
padding-bottom: 0.5rem;
}
.filter-and-search {
.form-field {
padding-bottom: 1.5rem;
}
.docket-summary-facets label {
margin-bottom: 0.5rem;
}
}
}
66 changes: 56 additions & 10 deletions user-interface/src/case-detail/CaseDetailScreen.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { formatDate } from '@/lib/utils/datetime';
import { CaseDetail } from '@common/cams/cases';
import { Debtor, DebtorAttorney } from '@common/cams/parties';
import { MockAttorneys } from '@common/cams/test-utilities/attorneys.mock';
import * as detailHeader from './panels/CaseDetailHeader';

const caseId = '101-23-12345';

Expand All @@ -31,13 +32,57 @@ describe('Case Detail screen tests', () => {

type MaybeString = string | undefined;

beforeAll(() => {
beforeEach(() => {
vi.restoreAllMocks();
process.env = {
...env,
CAMS_PA11Y: 'true',
};
});

test('should render CaseDetailHeader', async () => {
const testCaseDetail: CaseDetail = {
caseId: caseId,
dxtrId: '123',
chapter: '15',
regionId: '02',
officeName: 'New York',
officeCode: '000',
caseTitle: 'The Beach Boys',
dateFiled: '01-04-1962',
judgeName: rickBHartName,
courtId: '01',
courtName: 'Court of Law',
courtDivisionName: 'Manhattan',
courtDivisionCode: '081',
debtorTypeLabel: 'Corporate Business',
petitionLabel: 'Voluntary',
closedDate: '01-08-1963',
dismissedDate: '01-08-1964',
assignments: [brianWilson, carlWilson],
debtor: {
name: 'Roger Rabbit',
address1: '123 Rabbithole Lane',
address2: 'Apt 117',
address3: 'Suite C',
cityStateZipCountry: 'Ciudad Obregón GR 25443, MX',
},
debtorAttorney,
groupDesignator: '01',
regionName: 'Test Region',
};
const headerSpy = vi.spyOn(detailHeader, 'default');

render(
<BrowserRouter>
<CaseDetailScreen caseDetail={testCaseDetail} />
</BrowserRouter>,
);
await waitFor(() => {
expect(headerSpy).toHaveBeenCalled();
});
});

test('should display case title, case number, dates, assignees, judge name, and debtor for the case', async () => {
const testCaseDetail: CaseDetail = {
caseId: caseId,
Expand Down Expand Up @@ -77,11 +122,12 @@ describe('Case Detail screen tests', () => {

await waitFor(
async () => {
const title = screen.getByTestId('case-detail-heading');
expect(title.innerHTML).toEqual('The Beach Boys');
const title = screen.getByTestId('case-detail-heading-title');
const expectedTitle = ` - ${testCaseDetail.caseTitle}`;
expect(title.innerHTML).toEqual(expectedTitle);

const caseNumber = document.querySelector('.case-number');
expect(caseNumber?.innerHTML).toEqual(getCaseNumber(caseId));
expect(caseNumber?.innerHTML).toEqual(caseId);

const dateFiled = screen.getByTestId('case-detail-filed-date');
expect(dateFiled).toHaveTextContent('Filed');
Expand All @@ -99,7 +145,7 @@ describe('Case Detail screen tests', () => {
expect(chapter.innerHTML).toEqual('Voluntary Chapter&nbsp;15');

const courtName = screen.getByTestId('court-name-and-district');
expect(courtName.innerHTML).toEqual('Court of Law - Manhattan');
expect(courtName.innerHTML).toEqual(`Court of Law (${testCaseDetail.courtDivisionName})`);

const region = screen.getByTestId('case-detail-region-id');
expect(region.innerHTML).toEqual('Region 2 - New York Office');
Expand Down Expand Up @@ -605,11 +651,11 @@ describe('Case Detail screen tests', () => {
<CaseDetailScreen caseDetail={testCaseDetail} />
</BrowserRouter>,
);

const expectedTitle = ` - ${testCaseDetail.caseTitle}`;
await waitFor(
async () => {
const title = screen.getByTestId('case-detail-heading');
expect(title.innerHTML).toEqual('The Beach Boys');
const title = screen.getByTestId('case-detail-heading-title');
expect(title.innerHTML).toEqual(expectedTitle);

const unassignedElement = document.querySelector('.unassigned-placeholder');
expect(unassignedElement).toBeInTheDocument();
Expand Down Expand Up @@ -732,8 +778,8 @@ describe('Case Detail screen tests', () => {
);

const navRouteTestCases = [
['case-detail/1234', 'basic-info-link'],
['case-detail/1234/', 'basic-info-link'],
['case-detail/1234', 'case-overview-link'],
['case-detail/1234/', 'case-overview-link'],
['case-detail/1234/court-docket/', 'court-docket-link'],
];

Expand Down
2 changes: 1 addition & 1 deletion user-interface/src/case-detail/CaseDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { MainContent } from '@/lib/components/cams/MainContent/MainContent';
import { useApi2 } from '@/lib/hooks/UseApi2';

const CaseDetailHeader = lazy(() => import('./panels/CaseDetailHeader'));
const CaseDetailBasicInfo = lazy(() => import('./panels/CaseDetailBasicInfo'));
const CaseDetailBasicInfo = lazy(() => import('./panels/CaseDetailOverview'));
const CaseDetailCourtDocket = lazy(() => import('./panels/CaseDetailCourtDocket'));

jamesobrooks marked this conversation as resolved.
Show resolved Hide resolved
type SortDirection = 'Oldest' | 'Newest';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('Case Detail sort, search, and filter tests', () => {
expect(searchInput).toBeInTheDocument();
});

const basicInfoLink = screen.getByTestId('basic-info-link');
const basicInfoLink = screen.getByTestId('case-overview-link');
fireEvent.click(basicInfoLink as Element);
await waitFor(() => {
sortButton = screen.queryByTestId(sortButtonId);
Expand Down Expand Up @@ -139,7 +139,7 @@ describe('Case Detail sort, search, and filter tests', () => {
expect(searchInput).toBeInTheDocument();
});

const basicInfoLink = screen.getByTestId('basic-info-link');
const basicInfoLink = screen.getByTestId('case-overview-link');
fireEvent.click(basicInfoLink as Element);
await waitFor(() => {
sortButton = screen.queryByTestId(sortButtonId);
Expand Down Expand Up @@ -183,7 +183,7 @@ describe('Case Detail sort, search, and filter tests', () => {
expect(filterSelectElement).toBeInTheDocument();
});

const basicInfoLink = screen.getByTestId('basic-info-link');
const basicInfoLink = screen.getByTestId('case-overview-link');
fireEvent.click(basicInfoLink as Element);
await waitFor(() => {
filterSelectElement = document.querySelector(filterSelectClass);
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('Case Detail sort, search, and filter tests', () => {
expect(filterSelectElement).toBeInTheDocument();
});

const basicInfoLink = screen.getByTestId('basic-info-link');
const basicInfoLink = screen.getByTestId('case-overview-link');
fireEvent.click(basicInfoLink as Element);
await waitFor(() => {
filterSelectElement = document.querySelector(filterSelectClass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ describe('audit history tests', () => {
render(<CaseDetailAuditHistory caseId={caseId} />);

const emptyAssignments = await screen.findByTestId('empty-assignments-test-id');
expect(emptyAssignments).toHaveTextContent('There are no assignments in the case history.');
expect(emptyAssignments).toHaveTextContent('No changes have been made to this case');
fmaddenflx marked this conversation as resolved.
Show resolved Hide resolved

const historyTable = screen.queryByTestId('history-table');
expect(historyTable).not.toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ export default function CaseDetailAuditHistory(props: CaseDetailAuditHistoryProp
return (
<div className="case-audit-history">
<div className="history-type-title">
<h3>Audit History</h3>
<h3>Change History</h3>
{isAuditHistoryLoading && <LoadingIndicator />}
{!isAuditHistoryLoading && (
<>
{caseHistory.length < 1 && (
<div data-testid="empty-assignments-test-id">
<Alert
message="There are no assignments in the case history."
message="No changes have been made to this case"
fmaddenflx marked this conversation as resolved.
Show resolved Hide resolved
type={UswdsAlertStyle.Info}
role={'status'}
timeout={0}
Expand Down
Loading
Loading