@snapdragonsnursery/react-components 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapdragonsnursery/react-components",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -1,5 +1,5 @@
1
1
  // ChildSearchFilters Component Tests
2
- // Tests the filter functionality including status, site, date of birth, age, and sorting options
2
+ // Tests the filter functionality including status, site, date of birth, and age options
3
3
 
4
4
  import React from "react";
5
5
  import { render, screen, fireEvent, waitFor } from "@testing-library/react";
@@ -68,8 +68,6 @@ describe("ChildSearchFilters", () => {
68
68
  dobTo: "",
69
69
  ageFrom: "",
70
70
  ageTo: "",
71
- sortBy: "last_name",
72
- sortOrder: "asc",
73
71
  };
74
72
 
75
73
  const mockSites = [
@@ -107,8 +105,6 @@ describe("ChildSearchFilters", () => {
107
105
  expect(screen.getByText("Date of Birth Range")).toBeInTheDocument();
108
106
  expect(screen.getByText("Age From (months)")).toBeInTheDocument();
109
107
  expect(screen.getByText("Age To (months)")).toBeInTheDocument();
110
- expect(screen.getByText("Sort By")).toBeInTheDocument();
111
- expect(screen.getByText("Sort Order")).toBeInTheDocument();
112
108
  });
113
109
 
114
110
  it("hides advanced filters when isAdvancedFiltersOpen is false", () => {
@@ -157,7 +153,7 @@ describe("ChildSearchFilters", () => {
157
153
  );
158
154
 
159
155
  const selects = screen.getAllByTestId("select");
160
- expect(selects).toHaveLength(3); // Status, Sort By, Sort Order (no site filter when sites=null)
156
+ expect(selects).toHaveLength(1); // Only Status filter (no site filter when sites=null)
161
157
  });
162
158
 
163
159
  it("shows apply button when filters are changed", () => {
@@ -220,22 +216,6 @@ describe("ChildSearchFilters", () => {
220
216
  );
221
217
  });
222
218
 
223
- it("calls onApplyFilters when apply button is clicked with sort filter", () => {
224
- render(<ChildSearchFilters {...defaultProps} isAdvancedFiltersOpen={true} />);
225
-
226
- const sortBySelect = screen.getAllByTestId("select")[2];
227
- fireEvent.change(sortBySelect, { target: { value: "first_name" } });
228
-
229
- const applyButton = screen.getByText("Apply Filters");
230
- fireEvent.click(applyButton);
231
-
232
- expect(defaultProps.onApplyFilters).toHaveBeenCalledWith(
233
- expect.objectContaining({
234
- sortBy: "first_name"
235
- })
236
- );
237
- });
238
-
239
219
  it("displays correct filter values", () => {
240
220
  const filtersWithValues = {
241
221
  ...mockFilters,
@@ -245,8 +225,6 @@ describe("ChildSearchFilters", () => {
245
225
  dobTo: "2020-12-31",
246
226
  ageFrom: "12",
247
227
  ageTo: "60",
248
- sortBy: "first_name",
249
- sortOrder: "desc",
250
228
  };
251
229
 
252
230
  render(
@@ -262,16 +240,12 @@ describe("ChildSearchFilters", () => {
262
240
  const dateRangePicker = screen.getByTestId("date-range-picker");
263
241
  const ageFromInput = screen.getAllByTestId("input")[0];
264
242
  const ageToInput = screen.getAllByTestId("input")[1];
265
- const sortBySelect = screen.getAllByTestId("select")[2];
266
- const sortOrderSelect = screen.getAllByTestId("select")[3];
267
243
 
268
244
  expect(statusSelect).toHaveValue("inactive");
269
245
  expect(siteSelect).toHaveValue("1");
270
246
  expect(dateRangePicker).toBeInTheDocument();
271
247
  expect(ageFromInput).toHaveValue(12);
272
248
  expect(ageToInput).toHaveValue(60);
273
- expect(sortBySelect).toHaveValue("first_name");
274
- expect(sortOrderSelect).toHaveValue("desc");
275
249
  });
276
250
 
277
251
  it("has correct accessibility attributes", () => {
@@ -283,8 +257,6 @@ describe("ChildSearchFilters", () => {
283
257
  expect(screen.getByText("Date of Birth Range")).toBeInTheDocument();
284
258
  expect(screen.getByText("Age From (months)")).toBeInTheDocument();
285
259
  expect(screen.getByText("Age To (months)")).toBeInTheDocument();
286
- expect(screen.getByText("Sort By")).toBeInTheDocument();
287
- expect(screen.getByText("Sort Order")).toBeInTheDocument();
288
260
  });
289
261
 
290
262
  it("applies correct CSS classes for dark mode support", () => {