jQWidgets Forums
Forum Replies Created
-
Author
-
June 28, 2018 at 12:38 pm in reply to: Angular 6 using JQXGrid in the component of sub module Angular 6 using JQXGrid in the component of sub module #100769
Martin, for unit testing should the karma.conf.js also fill the “include” and “files” fields in the same way? I have another question posted in this forum with a simple starter Angular 6 project where I can “ng serve” but not “ng test”.
June 28, 2018 at 12:34 pm in reply to: Angular karma / jasmine unit tests Angular karma / jasmine unit tests #100768I will make this simpler: I have made a new angular project which does nothing other than load a single jqxGrid:
app.component.spec.ts :
import { TestBed, async, ComponentFixture } from '@angular/core/testing'; import { AppComponent } from './app.component'; import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid'; describe('AppComponent', () => { let component: AppComponent; let fixture: ComponentFixture<AppComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [jqxGridComponent, AppComponent] }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(AppComponent); component = fixture.componentInstance; }) it('app dummy test', () => { expect(1).toBe(2); }); });
app.component.ts :
import { Component } from '@angular/core'; import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { constructor() {} }
app.modules.ts :
import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid'; @NgModule({ declarations: [AppComponent, jqxGridComponent], imports: [BrowserModule], providers: [], bootstrap: [AppComponent] }) export class AppModule {}
Same behavior as before.
June 27, 2018 at 8:23 pm in reply to: Angular 6 using JQXGrid in the component of sub module Angular 6 using JQXGrid in the component of sub module #100753Hello mohanarao, I have a question posted related to jqx testing as well. Could you post your entire .spec file? Also your karma.conf.js file? What kind of unit test error were you getting?
June 27, 2018 at 7:46 pm in reply to: Angular karma / jasmine unit tests Angular karma / jasmine unit tests #100751Also, when first running “ng test” I get the “missing from Typescript compilation” error that others have complained about. When ng serving this is fixed by all the tsconfig changes mentioned here:
When I edit and re-save app.module.ts, the tests try to build themselves again – but this time I get
Uncaught ReferenceError: Zone is not defined at http://localhost:9876/
It is only after I edit and re-save app.module.ts again (and sometimes multiple times after that – with same “Zone is not defined” problem) that the tests will run – but with the problem in original post.
June 27, 2018 at 7:14 pm in reply to: Angular karma / jasmine unit tests Angular karma / jasmine unit tests #100748I should also note that using a mock grid within the declarations array works – so I do believe this is something jqx related.
-
AuthorPosts