Skip to content

Commit

Permalink
Merge pull request #5447 from flexion/10409-test-feedback
Browse files Browse the repository at this point in the history
10409: feedback
  • Loading branch information
nechama-krigsman authored Oct 14, 2024
2 parents 51040b3 + 0ffd9eb commit a8cb207
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
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 @@ -28,13 +28,15 @@ export const TrialSessions = connect(
sequences.resetTrialSessionsFiltersSequence,
showModal: state.modal.showModal,
trialSessionsHelper: state.trialSessionsHelper,
trialSessionsPageFilters: state.trialSessionsPage.filters,
},
function TrialSessions({
openCreateTermModalSequence,
openTrialSessionPlanningModalSequence,
resetTrialSessionsFiltersSequence,
showModal,
trialSessionsHelper,
trialSessionsPageFilters,
}) {
return (
<>
Expand Down Expand Up @@ -83,12 +85,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 @@ -399,6 +406,7 @@ const TrialSessionFilters = connect(
</div>
<Button
link
data-testid="trial-session-reset-filter-button"
disabled={trialSessionsHelper.isResetFiltersDisabled}
tooltip="Reset Filters"
onClick={() =>
Expand Down

0 comments on commit a8cb207

Please sign in to comment.