Angular 6, Karma, Can't bind to 'dtTrigger' since it isn't a known property of 'table'

Viewed 18

I have a component which renders a HTML with a angular-datatable, like this:

<div>
    <table
      datatable
      [dtTrigger]="dtTrigger"
      [dtOptions]="dtOptions"
      class="display responsive no-wrap row-border hover"
     >

It's working fine when I mount the actual Angular project, but when I try to test this component (with Jasmine and Karma), I got this error:

Can't bind to 'dtTrigger' since it isn't a known property of 'table'. ("
            <table
              datatable
              [ERROR ->][dtTrigger]="dtTrigger"
              [dtOptions]="dtOptions"
              class="display responsive"): ng:///DynamicTestModule/GestionSolicitudesComponent.html@62:14
Can't bind to 'dtOptions' since it isn't a known property of 'table'. ("
              datatable
              [dtTrigger]="dtTrigger"
              [ERROR ->][dtOptions]="dtOptions"
              class="display responsive no-wrap row-border hover"
           "): ng:///DynamicTestModule/GestionSolicitudesComponent.html@63:14

Reading other topics related to this, all mention things like: add DataTableModule to @NgModule() but this is not the case. The web is working fine, but for any reason, fails at testing.

The test is like this:

import { async, TestBed } from '@angular/core/testing'; import { GestionSolicitudesComponent } from './gestion-solicitudes.component';

describe('GestionSolicitudesComponent', () => {
  beforeEach(async(() => {
    console.log('aaca 0');
    TestBed.configureTestingModule({
      declarations: [
        GestionSolicitudesComponent
      ]
    })
    .compileComponents();
  }));

  it('should create', () => {
    // no code, and it fails anyway
  });
});

Any hint?

0 Answers
Related