From 8a443e08afdc6136f96b875a57e454f57240dc44 Mon Sep 17 00:00:00 2001 From: jantoun-scottlogic Date: Fri, 14 Jun 2024 16:28:00 +0100 Subject: [PATCH] Increase max screenheight ratio and update tests --- .../carbon-estimation/carbon-estimation.component.spec.ts | 2 +- src/app/carbon-estimation/carbon-estimation.component.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/carbon-estimation/carbon-estimation.component.spec.ts b/src/app/carbon-estimation/carbon-estimation.component.spec.ts index 3b53875b..793168e7 100644 --- a/src/app/carbon-estimation/carbon-estimation.component.spec.ts +++ b/src/app/carbon-estimation/carbon-estimation.component.spec.ts @@ -72,7 +72,7 @@ describe('CarbonEstimationComponent', () => { component.onResize(2000, 1000, 2000); expect(component.chart?.updateOptions).toHaveBeenCalledOnceWith({ - chart: { height: 1400 }, // Height will be capped at a percentage of the screen height + chart: { height: 1500 }, // Height will be capped at a percentage of the screen height }); }); diff --git a/src/app/carbon-estimation/carbon-estimation.component.ts b/src/app/carbon-estimation/carbon-estimation.component.ts index a876bac9..f7699c16 100644 --- a/src/app/carbon-estimation/carbon-estimation.component.ts +++ b/src/app/carbon-estimation/carbon-estimation.component.ts @@ -149,10 +149,10 @@ export class CarbonEstimationComponent implements OnInit, OnDestroy { calculatedHeight = innerHeight - this.estimatorBaseHeight - extraHeight - expansionPanelHeight; } - const maxScreenHeightRatio = 0.7; + const maxScreenHeightRatio = 0.75; - // Cap height based on screen height to prevent issues with chart becoming - // stretched when the component is displayed in a tall iFrame + // Cap chart height based on screen height to prevent issues with the chart + // becoming stretched when the component is displayed in a tall iFrame return Math.min(calculatedHeight, screenHeight * maxScreenHeightRatio); }