primeng icon indicating copy to clipboard operation
primeng copied to clipboard

ng test (Karma): Can't bind to 'X' since it isn't a known property of 'p-dataTable'.

Open rlexa opened this issue 9 years ago • 1 comments

I'm submitting a ...

[x ] bug report
[ ] feature request
[ ] support request

Similar to issue #767 but solution there (to add forms module) doesn't work (anymore).

Current behavior When running Karma tests the component using primeng datatable fails with seemingly not being able to resolve the p-dataTable component (the input values like value, scrollable etc. are unknown properties). While developing and serving the p-dataTable shows up and behaves perfectly fine.

Expected behavior Karma resolves p-dataTable and runs through.

Minimal reproduction of the problem with instructions

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
...
import { PrimengImportsModule } from '../../imports/primeng-imports.module';
...
  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [FormsModule, ..., PrimengImportsModule],
      declarations: [...],
      providers: [
        ...
      ]
    }).compileComponents();
  }));
...

The PrimengImportsModule imports/exports all primeng modules. Changing the above to import the DataTableModule directly from primeng/primeng doesn't help.

Please tell us about your environment: Windows 10 64, npm 5.0.3 + angular cli 1.1.0.

  • Angular version: 4.1.3

  • PrimeNG version: 4.0.3

  • Browser: Chrome

  • Language: TypeScript ~2.3.3

  • Node (for AoT issues): node --version = v6.10.3

rlexa avatar Jun 07 '17 10:06 rlexa

This is not a PrimeNG issue but seems like a config issue on your side, please use forum for support requests. It seems you need to import DataTable to your test module.

cagataycivici avatar Jun 07 '17 18:06 cagataycivici