Skip to content

Commit

Permalink
Fix translation and add test (#1716)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiraGeowerkstatt authored Dec 2, 2024
2 parents a5890ac + 22716bc commit 9638840
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/client/cypress/e2e/filters/filter.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,24 @@ describe("Search filter tests", () => {
});
});

it("filters boreholes by boreholestatus", () => {
loginAsAdmin();
cy.get('[data-cy="show-filter-button"]').click();
cy.contains("Borehole").click();
cy.contains("Show all fields").children(".checkbox").click();

let boreholeStatusDropdown = cy.contains("label", "Borehole status").next();

boreholeStatusDropdown.click();
boreholeStatusDropdown.find("div[role='option']").then(options => {
cy.wrap(options).contains("decayed").click({ force: true });
});
cy.wait("@edit_list");

cy.get('[data-cy="boreholes-number-preview"]').should("have.text", "169");
cy.get('[data-cy="filter-chip-boreholestatus"]').contains("Borehole status");
});

it("filters boreholes by color and uscs3", () => {
loginAsAdmin();
cy.get('[data-cy="show-filter-button"]').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const FilterChips = ({ activeFilters, setFilter }: FilterChipsProps) => {
{activeFilters.map((filter, index) => {
const customFilterLabels: { [key: string]: string } = {
role: "status",
status: "boreholeStatus",
status: "boreholestatus",
description_quality: "completeness",
layer_gradation: "gradation",
layer_depth_from_from: "fromdepth_from",
Expand All @@ -48,7 +48,7 @@ const FilterChips = ({ activeFilters, setFilter }: FilterChipsProps) => {
<Tooltip key={index} title={filterLabel.length > 15 && filterLabel}>
<Chip
sx={{ marginRight: "10px", marginBottom: "10px" }}
data-cy={`filter-chip-${filter.key}`}
data-cy={`filter-chip-${customFilterLabels[filter.key] || filter.key}`}
color="secondary"
label={filterLabel.length < 15 ? filterLabel : filterLabel.substring(0, 15) + "..."}
onDelete={() => onRemoveFilter(filter)}
Expand Down

0 comments on commit 9638840

Please sign in to comment.