diff --git a/frontend/src/metabase-lib/lib/Dimension.js b/frontend/src/metabase-lib/lib/Dimension.js index d3dc967b48dd277a6f7290178e431f732bc3d50e..58d15f9022961f2b46dde677956a9907d41282f0 100644 --- a/frontend/src/metabase-lib/lib/Dimension.js +++ b/frontend/src/metabase-lib/lib/Dimension.js @@ -598,6 +598,10 @@ export class FieldDimension extends Dimension { }); } + tableId() { + return this.field()?.table?.id; + } + /** * Return a copy of this FieldDimension that excludes `options`. */ @@ -1225,10 +1229,6 @@ export class TemplateTagDimension extends FieldDimension { return dimension ? dimension.field() : super.field(); } - tableId() { - return this.field()?.table?.id; - } - name() { return this.field().name; } diff --git a/frontend/test/metabase/scenarios/question/summarization.cy.spec.js b/frontend/test/metabase/scenarios/question/summarization.cy.spec.js index a65fe0c658066b6f8d1d895f3a830cfeedc832f0..01e10a45b8db95061cb2ddfe25ebfc7f4715a218 100644 --- a/frontend/test/metabase/scenarios/question/summarization.cy.spec.js +++ b/frontend/test/metabase/scenarios/question/summarization.cy.spec.js @@ -45,6 +45,7 @@ describe("scenarios > question > summarize sidebar", () => { // Displayed in the pinned list cy.findByTestId("pinned-dimensions").within(() => { + cy.findByText("Orders → Total").should("not.exist"); getDimensionByName({ name: "Total" }).should( "have.attr", "aria-selected", @@ -60,6 +61,27 @@ describe("scenarios > question > summarize sidebar", () => { }); }); + it("selected dimensions from another table includes the table name when becomes pinned to the top", () => { + getDimensionByName({ name: "State" }).click(); + + cy.button("Done").click(); + cy.findAllByText("Summarize") + .first() + .click(); + + cy.findByTestId("pinned-dimensions").within(() => { + getDimensionByName({ name: "People → State" }).should( + "have.attr", + "aria-selected", + "true", + ); + }); + + getRemoveDimensionButton({ name: "People → State" }).click(); + + cy.findByText("People → State").should("not.exist"); + }); + it("selecting a binning adds a dimension", () => { getDimensionByName({ name: "Total" }).click();