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

10409: feedback #5447

Merged
merged 4 commits into from
Oct 14, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('trial sessions filtering', () => {
tabName: 'new',
trialLocation,
});

cy.get(`[data-testid="trial-sessions-row-${trialSessionId}"]`).should(
'exist',
);
Expand Down Expand Up @@ -84,6 +85,7 @@ describe('trial sessions filtering', () => {
tabName: 'calendared',
trialLocation,
});

cy.get(`[data-testid="trial-sessions-row-${trialSessionId}"]`).should(
'exist',
);
Expand Down Expand Up @@ -111,6 +113,7 @@ describe('trial sessions filtering', () => {
tabName: 'calendared',
trialLocation,
});

cy.get(`[data-testid="trial-sessions-row-${trialSessionId}"]`).should(
'exist',
);
Expand All @@ -119,12 +122,14 @@ describe('trial sessions filtering', () => {
setTrialSessionFilters({
judge,
proceedingType,
resetFilters: true,
sessionStatus: 'All',
sessionType,
startDate,
tabName: 'calendared',
trialLocation,
});

cy.get(`[data-testid="trial-sessions-row-${trialSessionId}"]`).should(
'exist',
);
Expand All @@ -136,12 +141,14 @@ describe('trial sessions filtering', () => {
function setTrialSessionFilters({
judge,
proceedingType,
resetFilters,
sessionStatus,
sessionType,
startDate,
tabName,
trialLocation,
}: {
resetFilters?: boolean;
tabName: 'calendared' | 'new';
proceedingType: string;
startDate: string;
Expand All @@ -151,6 +158,9 @@ function setTrialSessionFilters({
sessionStatus?: string;
}) {
cy.get(`[data-testid="${tabName}-trial-sessions-tab"]`).click();
if (resetFilters) {
cy.get('[data-testid="trial-session-reset-filter-button"]').click();
}
if (sessionStatus) {
cy.get(`[data-testid="sessionStatus-${sessionStatus}"]`).click();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { runAction } from '@web-client/presenter/test.cerebral';
describe('resetTrialSessionsFiltersAction', () => {
it('should reset the trialSessions filters', async () => {
const result = await runAction(resetTrialSessionsFiltersAction, {
state: {},
state: { trialSessionsPage: { filters: { currentTab: 'new' } } },
});

expect(result.state.trialSessionsPage.filters).toEqual(
Expand Down
12 changes: 10 additions & 2 deletions web-client/src/views/TrialSessions/TrialSessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ export const TrialSessions = connect(
resetTrialSessionsFiltersSequence:
sequences.resetTrialSessionsFiltersSequence,
trialSessionsHelper: state.trialSessionsHelper,
trialSessionsPageFilters: state.trialSessionsPage.filters,
},
function TrialSessions({
openTrialSessionPlanningModalSequence,
resetTrialSessionsFiltersSequence,
trialSessionsHelper,
trialSessionsPageFilters,
}) {
return (
<>
Expand Down Expand Up @@ -64,12 +66,17 @@ export const TrialSessions = connect(
)}
</div>
<Tabs
bind="trialSessionsPage.filters.currentTab"
defaultActiveTab={'calendared'}
headingLevel="2"
id="trial-sessions-tabs"
value={trialSessionsPageFilters.currentTab}
onSelect={tabName => {
resetTrialSessionsFiltersSequence({ currentTab: tabName });
if (tabName === trialSessionsPageFilters.currentTab) {
return;
}
resetTrialSessionsFiltersSequence({
currentTab: tabName,
});
}}
>
{trialSessionsHelper.showNewTrialSession && (
Expand Down Expand Up @@ -379,6 +386,7 @@ const TrialSessionFilters = connect(
</div>
<Button
link
data-testid="trial-session-reset-filter-button"
disabled={trialSessionsHelper.isResetFiltersDisabled}
tooltip="Reset Filters"
onClick={() =>
Expand Down
Loading