Skip to content

Commit

Permalink
fix: Measures for Selection banner not rendered (PT-187459320) (#1291)
Browse files Browse the repository at this point in the history
  • Loading branch information
emcelroy authored May 31, 2024
1 parent d43e803 commit de57b1e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
32 changes: 15 additions & 17 deletions v3/cypress/e2e/graph.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,23 +283,21 @@ context("Graph UI", () => {
cy.wait(500)
cy.get("[data-testid=show-parent-toggles]").should("exist").and("have.text", "Show Parent Visibility Toggles")
})
// TODO: Get the tests below working. For some reason, the banner isn't being rendered in Cypress even though it
// seems to render fine in the browser.
// it("It adds a banner to the graph when Show Measures for Selection is activated", () => {
// cy.dragAttributeToTarget("table", "Sleep", "bottom")
// cy.get("[data-testid=measures-for-selection-banner]").should("not.exist")
// graph.getHideShowButton().click()
// cy.wait(500)
// cy.get("[data-testid=show-selection-measures]").click()
// cy.wait(500)
// cy.get("[data-testid=measures-for-selection-banner]")
// .should("exist").and("have.text", "Showing measures for 0 selected cases")
// graph.getHideShowButton().click()
// cy.wait(500)
// cy.get("[data-testid=show-selection-measures]").click()
// cy.wait(500)
// cy.get("[data-testid=measures-for-selection-banner]").should("not.exist")
// })
it("It adds a banner to the graph when Show Measures for Selection is activated", () => {
cy.dragAttributeToTarget("table", "Sleep", "bottom")
cy.get("[data-testid=measures-for-selection-banner]").should("not.exist")
graph.getHideShowButton().click()
cy.wait(500)
cy.get("[data-testid=show-selection-measures]").click()
cy.wait(500)
cy.get("[data-testid=measures-for-selection-banner]")
.should("exist").and("have.text", "Showing measures for 0 selected cases")
graph.getHideShowButton().click()
cy.wait(500)
cy.get("[data-testid=show-selection-measures]").click()
cy.wait(500)
cy.get("[data-testid=measures-for-selection-banner]").should("not.exist")
})
it("disables Point Size control when display type is bars", () => {
cy.dragAttributeToTarget("table", "Sleep", "bottom")
cy.wait(500)
Expand Down
6 changes: 3 additions & 3 deletions v3/src/components/graph/adornments/adornments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const Adornments = observer(function Adornments() {
)
}, [graphModel, layout])

if (!adornments?.length) return null
if (!adornments?.length && !graphModel.showMeasuresForSelection) return null

const adornmentBanners = adornments.map((adornment: IAdornmentModel) => {
const componentContentInfo = getAdornmentContentInfo(adornment.type)
Expand All @@ -50,7 +50,7 @@ export const Adornments = observer(function Adornments() {
BannerComponent && adornment.isVisible &&
<BannerComponent key={componentInfo.type} model={adornment} />
)
})
}).filter(banner => banner !== undefined)

const xAttrId = dataConfig?.attributeID("x")
const xAttrType = dataConfig?.attributeType("x")
Expand Down Expand Up @@ -156,7 +156,7 @@ export const Adornments = observer(function Adornments() {
)
return (
<>
{adornmentBanners &&
{(adornmentBanners.length > 0 || graphModel.showMeasuresForSelection) &&
<div className="graph-adornments-banners" data-testid="graph-adornments-banners">
{graphModel.showMeasuresForSelection && <MeasuresForSelectionBanner />}
{adornmentBanners}
Expand Down

0 comments on commit de57b1e

Please sign in to comment.