Jest Coverage Test - 'kendoGrid' not found

1 Answer 508 Views
Grid PDF Export
August
Top achievements
Rank 1
August asked on 29 Jun 2022, 11:11 PM

In the Trigger Export Externally example, the source code requires an Element Ref ID to be added:

<kendo-grid
     #grid="kendoGrid"
     ...
>
...
<kendo-grid-pdf
     fileName="Products.pdf"
     [allPages]="true"
     paperSize="A4"
     [repeatHeaders]="true"
     [landscape]="true"
>
</kendo-grid>

<button kendoButton (click)="exportToPDF(grid)">Export Grid to PDF</button>

ERRORS in Jest:

The only error shown after running a coverage test is the following:

NG0301: Export of name 'kendoGrid' not found!. Find more at https://angular.io/errors/NG0301

This basically says that I need to import into my *.module.ts -- but I am not seeing in the forums what exactly needs to be imported to help satisfy the tests.

Please advise!

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Bechev
Telerik team
answered on 04 Jul 2022, 09:23 AM

Hi August,

Thank you for the provided code snippet.

Please try removing the knedoGrid definition and leave just the reference of the Grid:

<kendo-grid
     #grid
     ...
>

Ensure that the GridModule and PDFModule of the Grid package are imported in the correct module (where the component is declared):

...
import { GridModule, PDFModule } from '@progress/kendo-angular-grid';

@NgModule({
  imports: [..., GridModule, PDFModule]
...
})

export class MyAppModule { }

I hope this sheds some light on the case.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

August
Top achievements
Rank 1
commented on 05 Jul 2022, 11:33 PM

Removing the "kendoGrid" definition and leaving in the grid reference worked.

Thank you very much!

Tags
Grid PDF Export
Asked by
August
Top achievements
Rank 1
Answers by
Martin Bechev
Telerik team
Share this question
or