Skip to content
Snippets Groups Projects
Unverified Commit 435ef211 authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Fix Pie chart visualization error when rows contain nils (#13721)


* Fix Pie chart visualization error when rows contain nils (#13626)

* Add positive assertion to CY test

* Fix prettier linter

* Quarantine the failing part of the "Pie chart" test

Co-authored-by: default avatarNemanja <31325167+nemanjaglumac@users.noreply.github.com>
parent 8be8f81f
No related merge requests found
......@@ -375,21 +375,29 @@ export default class PieChart extends Component {
value = formatMetric(total);
}
const getSliceClickObject = index => ({
value: slices[index].value,
column: cols[metricIndex],
data: rows[slices[index].rowIndex].map((value, index) => ({
value,
col: cols[index],
})),
dimensions: [
{
value: slices[index].key,
column: cols[dimensionIndex],
},
],
settings,
});
const getSliceClickObject = index => {
const slice = slices[index];
const sliceRows = slice.rowIndex && rows[slice.rowIndex];
const data =
sliceRows &&
sliceRows.map((value, index) => ({
value,
col: cols[index],
}));
return {
value: slice.value,
column: cols[metricIndex],
data: data,
dimensions: [
{
value: slice.key,
column: cols[dimensionIndex],
},
],
settings,
};
};
const isClickable =
onVisualizationClick && visualizationIsClickable(getSliceClickObject(0));
......
......@@ -37,7 +37,11 @@ describe("scenarios > question > null", () => {
});
});
it.skip("(metabase#13626)", () => {
// [quarantine]
// - possible app corruption and new issue with rendering discovered
// - see: https://github.com/metabase/metabase/pull/13721#issuecomment-724931075
// - test was intermittently failing
it.skip("pie chart should handle `0`/`null` values (metabase#13626)", () => {
// Preparation for the test: "Arrange and Act phase" - see repro steps in #13626
withSampleDataset(({ ORDERS }) => {
// 1. create a question
......@@ -109,9 +113,14 @@ describe("scenarios > question > null", () => {
cy.findByText("13626D");
cy.log("**Reported failing in v0.37.0.2**");
// TODO: Once the issue is fixed, add a positive asssertion here
cy.get(".DashCard").within(() => {
cy.get(".LoadingSpinner").should("not.exist");
cy.findByText("13626");
// [quarantine]: flaking in CircleCI, passing locally
// TODO: figure out the cause of the failed test in CI after #13721 is merged
// cy.get("svg[class*=PieChart__Donut]");
// cy.get("[class*=PieChart__Value]").contains("0");
// cy.get("[class*=PieChart__Title]").contains(/total/i);
});
});
});
......
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