Skip to content
Snippets Groups Projects
Unverified Commit ce95331f authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Rename date/time empty filter options in the simple mode (#44102)

* Rename "empty" date/time filter options

* Add repro for #44101
parent 7de0faa6
No related branches found
No related tags found
No related merge requests found
......@@ -4,9 +4,10 @@ import {
popover,
restore,
tableHeaderClick,
openTable,
} from "e2e/support/helpers";
const { REVIEWS, REVIEWS_ID } = SAMPLE_DATABASE;
const { REVIEWS, REVIEWS_ID, ACCOUNTS_ID } = SAMPLE_DATABASE;
describe("scenarios > visualizations > drillthroughs > table_drills", () => {
beforeEach(() => {
......@@ -210,3 +211,36 @@ describe("scenarios > visualizations > drillthroughs > table_drills", () => {
.should("be.visible");
});
});
describe("scenarios > visualizations > drillthroughs > table_drills > nulls", () => {
beforeEach(() => {
// It's important to restore to the "setup" to have access to "Accounts" table
restore("setup");
cy.signInAsAdmin();
cy.viewport(1500, 800);
});
it("should display proper drills on a datetime cell click when there is no value (metabase#44101)", () => {
const CANCELLED_AT_INDEX = 9;
openTable({ table: ACCOUNTS_ID, limit: 1 });
cy.findAllByRole("gridcell")
.eq(CANCELLED_AT_INDEX)
.should("have.text", "")
.click({ force: true });
popover().within(() => {
cy.findByText("Filter by this date").should("be.visible");
cy.findByText("Is empty").should("be.visible");
cy.findByText("Not empty").should("be.visible").click();
});
cy.findByTestId("filter-pill").should(
"have.text",
"Canceled At is not empty",
);
cy.findAllByRole("gridcell")
.eq(CANCELLED_AT_INDEX)
.should("not.have.text", "");
});
});
......@@ -37,24 +37,37 @@ function getActionOverrides(
operator: Lib.QuickFilterDrillThruOperator,
value: unknown,
): Partial<ClickAction> {
if (Lib.isDate(column) && value != null) {
if (Lib.isDate(column)) {
const action: Partial<ClickAction> = {
sectionTitle: t`Filter by this date`,
sectionDirection: "column",
buttonType: "horizontal",
};
switch (operator) {
case "=":
return { ...action, title: t`On` };
case "":
return { ...action, title: t`Not on` };
case ">":
return { ...action, title: t`After` };
case "<":
return { ...action, title: t`Before` };
default:
return action;
if (value !== null) {
switch (operator) {
case "=":
return { ...action, title: t`On` };
case "":
return { ...action, title: t`Not on` };
case ">":
return { ...action, title: t`After` };
case "<":
return { ...action, title: t`Before` };
default:
return action;
}
}
if (value === null) {
switch (operator) {
case "=":
return { ...action, title: t`Is empty` };
case "":
return { ...action, title: t`Not empty` };
default:
return action;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment