-
-
Save homj/24e2d3898d013013616304d1faff4315 to your computer and use it in GitHub Desktop.
ngx-echarts test teardown bug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core'; | |
import { ComponentFixture, TestBed } from '@angular/core/testing'; | |
import { By } from '@angular/platform-browser'; | |
import * as echarts from 'echarts'; | |
import { NgxEchartsDirective, NgxEchartsModule } from 'ngx-echarts'; | |
@Component({ | |
template: '<div echarts [options]="options"></div>' | |
}) | |
class TestHostComponent { | |
options?: echarts.EChartsOption; | |
} | |
describe('echarts integration', () => { | |
let component: TestHostComponent; | |
let fixture: ComponentFixture<TestHostComponent>; | |
beforeEach(async () => { | |
await TestBed.configureTestingModule({ | |
imports: [ | |
NgxEchartsModule.forRoot({ echarts }) | |
], | |
declarations: [ | |
TestHostComponent | |
] | |
}).compileComponents(); | |
fixture = TestBed.createComponent(TestHostComponent); | |
component = fixture.componentInstance; | |
fixture.detectChanges(); | |
}); | |
it('should change the options', () => { | |
const echarts = fixture.debugElement.query(By.directive(NgxEchartsDirective)).injector.get(NgxEchartsDirective); | |
component.options = { | |
series: [ | |
{ | |
type: 'gauge', | |
data: [{ value: 0.3 }] | |
} | |
] | |
}; | |
fixture.detectChanges(); | |
expect(echarts.options).toBe(component.options); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @homj,
I can't reproduce the error when test it with Jest or Karma. Both of the tests are passed.
Do I miss anything?