Skip to content

Commit

Permalink
Add test for lower bound on chart height
Browse files Browse the repository at this point in the history
  • Loading branch information
jantoun-scottlogic committed Jun 20, 2024
1 parent a93c77e commit 58b30d1
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/app/carbon-estimation/carbon-estimation.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down Expand Up @@ -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');

Expand Down

0 comments on commit 58b30d1

Please sign in to comment.