Skip to content

Commit fe0a0c7

Browse files
mxosmanMahmoud
and
Mahmoud
authored
Remove judicial district dropdown for ND (#660)
* Remove judicial district dropdown for ND * Update tests * Slight adjustment to comments - add note about it being just for ND --------- Co-authored-by: Mahmoud <[email protected]>
1 parent 42201c1 commit fe0a0c7

File tree

3 files changed

+14
-31
lines changed

3 files changed

+14
-31
lines changed

spotlight-client/src/LocalityFilterSelect/LocalityFilterSelect.test.tsx

+6-26
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
// along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
// =============================================================================
1717

18-
import { render, screen, fireEvent } from "@testing-library/react";
18+
import { render, screen } from "@testing-library/react";
1919
import React from "react";
20+
import contentFixture from "../contentModels/__fixtures__/tenant_content_exhaustive";
2021
import createMetricMapping from "../contentModels/createMetricMapping";
2122
import type PopulationBreakdownByLocationMetric from "../contentModels/PopulationBreakdownByLocationMetric";
22-
import contentFixture from "../contentModels/__fixtures__/tenant_content_exhaustive";
23-
import { reactImmediately } from "../testUtils";
2423
import LocalityFilterSelect from "./LocalityFilterSelect";
2524

2625
const testTenantId = "US_ND";
@@ -57,40 +56,21 @@ test("has expected options", () => {
5756
const metric = getTestMetric();
5857
render(<LocalityFilterSelect metric={metric} />);
5958

60-
const menuButton = screen.getByRole("button", {
59+
const menuButton = screen.queryByRole("button", {
6160
name: "Judicial District All Districts",
6261
});
63-
fireEvent.click(menuButton);
64-
65-
const options = screen.getAllByRole("option");
66-
67-
expect(options.length).toBe(expectedLocalities.length);
6862

69-
options.forEach((option, index) =>
70-
expect(option).toHaveTextContent(expectedLocalities[index].label)
71-
);
63+
expect(menuButton).toBeNull(); // Jurisdiction Dropdowns should no longer display for ND as of February 2025
7264
});
7365

7466
test("changes demographic filter", () => {
7567
const metric = getTestMetric();
7668
render(<LocalityFilterSelect metric={metric} />);
7769

78-
const menuButton = screen.getByRole("button", {
70+
const menuButton = screen.queryByRole("button", {
7971
name: "Judicial District All Districts",
8072
});
8173

82-
expectedLocalities.forEach((expectedLocality) => {
83-
// open the menu
84-
fireEvent.click(menuButton);
85-
86-
const option = screen.getByRole("option", { name: expectedLocality.label });
87-
fireEvent.click(option);
88-
89-
reactImmediately(() => {
90-
expect(metric.localityId).toBe(expectedLocality.id);
91-
expect(menuButton).toHaveTextContent(expectedLocality.label);
92-
});
93-
});
94-
74+
expect(menuButton).toBeNull(); // Jurisdiction Dropdowns should no longer display for ND as of February 2025
9575
expect.hasAssertions();
9676
});

spotlight-client/src/LocalityFilterSelect/LocalityFilterSelect.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ const LocalityFilterSelect: React.FC<LocalityFilterSelectProps> = ({
3939
});
4040

4141
// if there are no locality entries, don't display the dropdown. We are skipping this for Idaho launch. See https://github.com/Recidiviz/public-dashboard/issues/582
42-
if (metric.localityLabels.entries.length === 0) {
42+
if (
43+
metric.localityLabels.entries.length === 0 ||
44+
// The judicial district dropdown for ND should no longer be visible in the UI due to unreliable disaggregation data (based on ND dashboard audit)
45+
(metric.tenantId === "US_ND" &&
46+
metric.localityLabels.label === "Judicial District")
47+
) {
4348
return null;
4449
}
4550

spotlight-client/src/VizSentenceTypeByLocation/VizSentenceTypeByLocation.test.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,9 @@ test("locality filter", async () => {
134134

135135
await when(() => !metric.isLoading);
136136

137-
const menuButton = screen.getByRole("button", {
137+
const menuButton = screen.queryByRole("button", {
138138
name: "Judicial District All Districts",
139139
});
140-
fireEvent.click(menuButton);
141-
fireEvent.click(screen.getByRole("option", { name: "South Central" }));
142140

143-
verifySankey(["Total"], ["1,340", "735", "445"]);
141+
expect(menuButton).toBeNull(); // Jurisdiction Dropdowns should no longer display for ND as of February 2025
144142
});

0 commit comments

Comments
 (0)