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

Display chart caption even where there is no card title (#36801)

* Display chart caption even where there is no card title

* Add E2E reproduction for #36788
parent 1dda54f4
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,8 @@ import {
editDashboard,
showDashboardCardActions,
modal,
saveDashboard,
getDashboardCardMenu,
} from "e2e/support/helpers";
import { ORDERS_DASHBOARD_ID } from "e2e/support/cypress_sample_instance_data";
......@@ -15,22 +17,30 @@ describe("scenarios > dashboard cards > visualization options", () => {
cy.signInAsAdmin();
});
it("should allow empty card title (metabase#12013)", () => {
it("should allow empty card title (metabase#12013, metabase#36788)", () => {
const originalCardTitle = "Orders";
visitDashboard(ORDERS_DASHBOARD_ID);
cy.findByTextEnsureVisible("Orders");
cy.findByTestId("legend-caption").should("exist");
cy.findByTestId("legend-caption")
.should("contain", originalCardTitle)
.and("be.visible");
editDashboard();
showDashboardCardActions();
cy.icon("palette").click();
modal().within(() => {
cy.findByDisplayValue("Orders").click().clear();
cy.findByDisplayValue(originalCardTitle).click().clear();
cy.button("Done").click();
});
cy.findByTestId("legend-caption").should("not.exist");
cy.findByTestId("legend-caption").should("not.contain", originalCardTitle);
saveDashboard();
getDashboardCard().realHover();
getDashboardCardMenu().click();
popover()
.should("contain", "Edit question")
.and("contain", "Download results");
});
it("column reordering should work (metabase#16229)", () => {
......
......@@ -39,10 +39,6 @@ const ChartCaption = ({
});
}, [card, onChangeCardAndRun]);
if (!title) {
return null;
}
return (
<ChartCaptionRoot
title={title}
......
......@@ -62,13 +62,13 @@ const setup = (props: Partial<Props> = {}) => {
};
describe("ChartCaption", () => {
it("shouldn't render without title", () => {
it("should render without a title (metabase#36788)", () => {
setup();
expect(screen.queryByTestId("legend-caption")).not.toBeInTheDocument();
expect(screen.getByTestId("legend-caption")).toBeInTheDocument();
});
it("should render with title", () => {
it("should render with a title", () => {
setup({
series: getSeries({ card: createMockCard({ name: "card name" }) }),
settings: { "card.description": "description" },
......
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