Skip to content

Commit

Permalink
Update remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jantoun-scottlogic committed Jun 20, 2024
1 parent 2a90b42 commit a93c77e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/app/carbon-estimation/carbon-estimation.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,26 @@ describe('CarbonEstimationComponent', () => {
});

it('should set chart height when inner height is more than base height', () => {
spyOnProperty(window, 'innerHeight').and.returnValue(1000);
spyOnProperty(component.detailsPanel.nativeElement, 'clientHeight').and.returnValue(200);

component.ngOnInit();
fixture.detectChanges();

expect(component.chartOptions.chart.height).toBe(600 - estimatorBaseHeight - 200);
console.log(`window.innerHeight: ${window.innerHeight}`);
expect(component.chartOptions.chart.height).toBe(1000 - estimatorBaseHeight - 200);
});

it('should set chart height to value if inner height more than base height plus extra height', () => {
spyOnProperty(window, 'innerHeight').and.returnValue(1000);
spyOnProperty(component.detailsPanel.nativeElement, 'clientHeight').and.returnValue(200);

fixture.componentRef.setInput('extraHeight', '100');
fixture.detectChanges();
component.ngOnInit();
fixture.detectChanges();

expect(component.chartOptions.chart.height).toBe(600 - estimatorBaseHeight - 200 - 100);
expect(component.chartOptions.chart.height).toBe(1000 - estimatorBaseHeight - 200 - 100);
});

it('should recalculate chart height on window resize, for laptop screen', () => {
Expand Down

0 comments on commit a93c77e

Please sign in to comment.