diff --git a/src/components/learner-credit-management/BudgetDetailPageOverviewAvailability.jsx b/src/components/learner-credit-management/BudgetDetailPageOverviewAvailability.jsx index b8a7e0490d..500bbf47e1 100644 --- a/src/components/learner-credit-management/BudgetDetailPageOverviewAvailability.jsx +++ b/src/components/learner-credit-management/BudgetDetailPageOverviewAvailability.jsx @@ -30,7 +30,7 @@ const BudgetActions = ({ const { enterpriseSlug, enterpriseAppPage } = useParams(); const { subsidyAccessPolicyId } = useBudgetId(); const { data: subsidyAccessPolicy } = useSubsidyAccessPolicy(subsidyAccessPolicyId); - const { data: appliesToAllContexts } = useEnterpriseGroup(subsidyAccessPolicy); + const { data: enterpriseGroup } = useEnterpriseGroup(subsidyAccessPolicy); const { data: enterpriseCustomer } = useEnterpriseCustomer(enterpriseId); const { openInviteModal } = useContext(BudgetDetailPageContext); const supportUrl = configuration.ENTERPRISE_SUPPORT_URL; @@ -95,7 +95,7 @@ const BudgetActions = ({ if (!isAssignable) { if (enterpriseGroupsV1) { - if (isLmsBudget(enterpriseCustomer?.activeIntegrations.length, appliesToAllContexts)) { + if (isLmsBudget(enterpriseCustomer?.activeIntegrations.length, enterpriseGroup?.appliesToAllContexts)) { return (
@@ -103,7 +103,7 @@ const BudgetActions = ({

@@ -114,7 +114,7 @@ const BudgetActions = ({ values={{ apostrophe: "'" }} />

- +
); - } if (appliesToAllContexts === true) { -
-
-

- -

-

- -

- - - , + +

+ +

+ + + +
-
; + ); } + return (
diff --git a/src/components/learner-credit-management/MultipleBudgetsPicker.jsx b/src/components/learner-credit-management/MultipleBudgetsPicker.jsx index 8816cddd3b..dd476b48ed 100644 --- a/src/components/learner-credit-management/MultipleBudgetsPicker.jsx +++ b/src/components/learner-credit-management/MultipleBudgetsPicker.jsx @@ -85,6 +85,7 @@ const MultipleBudgetsPicker = ({ description: 'Header for the status column in the budget picker page.', }), accessor: 'status', + filter: 'includesValue', Filter: CheckboxFilter, filterChoices: reducedChoices, }, diff --git a/src/components/learner-credit-management/tests/MultipleBudgetsPage.test.jsx b/src/components/learner-credit-management/tests/MultipleBudgetsPage.test.jsx index 041114312b..992739e579 100644 --- a/src/components/learner-credit-management/tests/MultipleBudgetsPage.test.jsx +++ b/src/components/learner-credit-management/tests/MultipleBudgetsPage.test.jsx @@ -9,6 +9,7 @@ import { render, } from '@testing-library/react'; import '@testing-library/jest-dom/extend-expect'; +import userEvent from '@testing-library/user-event'; import { IntlProvider } from '@edx/frontend-platform/i18n'; @@ -36,14 +37,34 @@ jest.mock('../../EnterpriseSubsidiesContext/data/hooks', () => ({ ...jest.requireActual('../../EnterpriseSubsidiesContext/data/hooks'), useEnterpriseBudgets: jest.fn().mockReturnValue({ data: { - budgets: [{ - source: 'subsidy', - id: '392f1fe1-ee91-4f44-b174-13ecf59866eb', - name: 'Subsidy 2 for Executive Education (2U) Integration QA', - start: '2023-06-07T15:38:29Z', - end: '2024-06-07T15:38:30Z', - isCurrent: true, - }, + budgets: [ + { + source: 'subsidy', + id: '392f1fe1-ee91-4f44-b174-13ecf59866eb', + name: 'Subsidy 2 for Executive Education (2U) Integration QA', + start: '2023-06-07T15:38:29Z', + end: '2024-06-07T15:38:30Z', + isCurrent: true, + isRetired: false, + }, + { + source: 'subsidy', + id: '392f1fe1-ee91-4f44-b174-13ecf59866e3', + name: 'Subsidy 3', + start: '2023-06-07T15:38:29Z', + end: '2024-06-07T15:38:30Z', + isCurrent: true, + isRetired: true, + }, + { + source: 'subsidy', + id: '392f1fe1-ee91-4f44-b174-13ecf59866ef', + name: 'Subsidy 4', + start: '2023-06-07T15:38:29Z', + end: '2024-06-07T15:38:30Z', + isCurrent: true, + isRetired: false, + }, ], }, }), @@ -88,6 +109,13 @@ describe('', () => { it('budgets for your organization', () => { render(); expect(screen.getByText('Budgets')); + const filterButton = screen.getByText('Filters'); + userEvent.click(filterButton); + const checkboxes = screen.queryAllByRole('checkbox'); + checkboxes.forEach(checkbox => { + userEvent.click(checkbox); + }); + expect(screen.getByText('Showing 3 of 3.')).toBeInTheDocument(); }); it('Shows loading spinner', () => { const enterpriseSubsidiesContextValue = {