beforeEach(async(() => {
   routeParamsSubject.next({
     id: '404',
     resource: 'entities',
   });
   fixture.autoDetectChanges();
 }));
  beforeEach(() => {
    fixture = TestBed.createComponent(HeroDetailComponent);
    component = fixture.componentInstance;
    el = fixture.debugElement;

    fixture.autoDetectChanges();
  });
 beforeEach(async(() => {
   const searchbar: NgorDatagridSearchComponent = fixture.debugElement
     .query(By.directive(NgorDatagridSearchComponent)).componentInstance;
   searchbar.searchFormGroup.controls.search.setValue('404');
   searchbar.doSearch();
   fixture.autoDetectChanges();
 }));
Example #4
0
 beforeEach(async(() => TestUtils.beforeEachCompiler([ClickerForm]).then(compiled => {
   fixture = compiled.fixture;
   instance = compiled.instance;
   instance.clicker = { name: 'TEST CLICKER' };
   instance.clicker.getCount = function(): number { return 10; };
   fixture.autoDetectChanges(true);
 })));
  beforeEach(() => {
    fixture = TestBed.createComponent(DashboardComponent);
    component = fixture.componentInstance;
    el = fixture.debugElement.nativeElement;

    fixture.autoDetectChanges();
  });
 beforeEach(async(inject([NGOR_ENTITIES_RANGES], (ranges: number[]) => {
   const [, newRange] = ranges;
   const toolbar: NgorDatagridToolbarComponent = fixture.debugElement
     .query(By.directive(NgorDatagridToolbarComponent)).componentInstance;
   toolbar.range = newRange;
   toolbar.rangeChange();
   fixture.autoDetectChanges();
 })));
  beforeEach(async(() => {
    spyLocation.back.calls.reset();

    fixture = TestBed
      .configureTestingModule({
        declarations: [
          MockListComponent,
          MockCreateComponent,
          MockDetailComponent,
          MockDeleteComponent,
          MockChildComponent,
          MockParentComponent,
        ],
        imports: [
          HttpClientTestingModule,
          NgorCoreModule.forRoot({
            resources: [{
              components: {
                create: MockCreateComponent,
                delete: MockDeleteComponent,
                detail: MockDetailComponent,
                list: MockListComponent,
                nested: MockParentComponent,
              },
              endPoint: 'endpoint',
              name: 'entities',
            }],
          }),
        ],
        providers: [
          {
            multi: true,
            provide: ANALYZE_FOR_ENTRY_COMPONENTS,
            useValue: [
              MockListComponent,
              MockCreateComponent,
              MockDetailComponent,
              MockDeleteComponent,
              MockParentComponent,
            ],
          },
        ],
      })
      .overrideComponent(NgorBaseComponent, {
        set: {
          providers: [
            NgorResourceComponentsService,
            { provide: ActivatedRoute, useValue: spyActivatedRoute },
            { provide: Location, useValue: spyLocation },
          ],
        },
      })
      .createComponent(NgorBaseComponent);

    httpBackend = TestBed.get(HttpTestingController);

    fixture.autoDetectChanges();
  }));
Example #8
0
export function initTest(testCpt: any, tpl: string): {fixture: ComponentFixture<any>, rootRenderer: ReactNativeRootRenderer} {
  TestBed.overrideComponent(testCpt, {set: {template: tpl}});
  const rootRenderer: ReactNativeRootRenderer = getTestBed().get(ReactNativeRootRenderer);
  rootRenderer.zone = getTestBed().get(NgZone);
  const fixture: ComponentFixture<any> = TestBed.createComponent(testCpt);
  fixture.autoDetectChanges();
  rootRenderer.executeCommands();
  return {fixture: fixture, rootRenderer: rootRenderer};
}
    beforeEach(async(() => {
      fixture = TestBed.configureTestingModule({
        declarations: [
          TestNgorDatagridComponent,
        ],
        imports: [
          TranslateModule.forRoot(),
          RouterModule.forRoot([], { useHash: true }),
          NgorCoreModule.forRoot({
            resources: [],
          }),
          NgorListModule.forRoot(),
        ],
        providers: [
          { provide: NgorResourceComponentsService, useValue: spyNgorResourceComponentsService },
        ],
      })
        .createComponent(TestNgorDatagridComponent);

      fixture.autoDetectChanges();
    }));
 beforeEach(async(() => {
   fixture.debugElement.query(By.css('.table tr th + th + th'))
     .triggerEventHandler('click', new Event('click'));
   fixture.autoDetectChanges();
 }));
 beforeEach(async(() => {
   fixture.componentInstance.filterParams = [{ key: 'name' }];
   fixture.autoDetectChanges();
 }));
 beforeEach(async(() => {
   const toolbar: NgorDatagridToolbarComponent = fixture.debugElement
     .query(By.directive(NgorDatagridToolbarComponent)).componentInstance;
   toolbar.pageChange(2);
   fixture.autoDetectChanges();
 }));
 it('should call onClick method when button is clicked', () => {
   fixture.autoDetectChanges();
   const spyfn = spy(component, 'onClick');
   de.children[0].nativeElement.click();
   expect(spyfn.called).to.equal(true);
 });