diff --git a/src/app/carbon-estimation/carbon-estimation.component.spec.ts b/src/app/carbon-estimation/carbon-estimation.component.spec.ts index a595d481..fb525430 100644 --- a/src/app/carbon-estimation/carbon-estimation.component.spec.ts +++ b/src/app/carbon-estimation/carbon-estimation.component.spec.ts @@ -54,7 +54,6 @@ describe('CarbonEstimationComponent', () => { component.ngOnInit(); fixture.detectChanges(); - console.log(`window.innerHeight: ${window.innerHeight}`); expect(component.chartOptions.chart.height).toBe(1000 - estimatorBaseHeight - 200); }); @@ -116,6 +115,17 @@ describe('CarbonEstimationComponent', () => { }); }); + it('should have a chart height of 300 for small innerHeight values (if screen height is large enough)', () => { + spyOn(component.chart as ChartComponent, 'updateOptions'); + spyOnProperty(component.detailsPanel.nativeElement, 'clientHeight').and.returnValue(200); + + component.onResize(100, 1000, 2000); + + expect(component.chart?.updateOptions).toHaveBeenCalledOnceWith({ + chart: { height: 300 }, + }); + }); + it('should call onResize when onExpansion is called', () => { spyOn(component, 'onResize');