plotly / plotly/angular-plotly.js
Angular Plotly test TypeError: Cannot read properties of undefined (reading 'data')
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 242
- Forks
- 81
- Ø Merge
- 8 Std. 48 Min.
- Gemergte PRs (30 T.)
- 18
Beschreibung
i am having an issue running the tests file for my page
TypeError: Cannot read properties of undefined (reading 'data')
TypeError: Cannot read properties of undefined (reading 'data')
at PlotlyComponent.createFigure (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-plotly.js/__ivy_ngcc__/fesm2015/angular-plotly.js.js:285:21)
at PlotlyComponent.call [as ngOnDestroy] (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-plotly.js/__ivy_ngcc__/fesm2015/angular-plotly.js.js:195:29)
at executeOnDestroys (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6537:32)
at cleanUpView (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6438:9)
at destroyViewTree (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6264:21)
at destroyLView (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6416:9)
at RootViewRef.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:13512:9)
at ComponentRef.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:13958:23)
at ComponentFixture.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/testing.mjs:228:31)
at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/webpack:/src/app/pages/graph.component.spec.ts:163:17)
i am using PlotlyViaWindowModule, when i start ng serve the plot is working correctly without any issues but i cant run the test
describe('GraphComponent', () => {
let component: GraphComponent;
let fixture: ComponentFixture<GraphComponent>;
let debugElement: DebugElement;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [... , PlotlyComponent], providers: [...PlotlyService, { provide: MyPlotService, useClass: myPlotServiceMock},
], imports: [
...
PlotlyViaWindowModule,]
beforeEach(() => {
fixture = TestBed.createComponent(GraphComponent);
component = fixture.componentInstance;
debugElement = fixture.debugElement;
fixture.detectChanges();
});
it('shoud create the app', () => {
expect(component).toBeTruthy();
});
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, den fehlschlagenden GraphComponent-Spec in src/app/pages/graph.component.spec.ts auszuführen, und überprüfe die Einrichtung von PlotlyViaWindowModule. Verfolge den createFigure-Aufruf von PlotlyComponent während ngOnDestroy, wobei der gemeldete Stack Trace als Einstiegspunkt dient. Als erledigt gilt die Aufgabe, wenn der Test ohne TypeError abgeschlossen wird, während die Komponente mit ng serve weiterhin verwendbar bleibt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, plotly, typescript
- Bereich
- frontend, testing
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100