( data: TestData[], columns: ColumnDef<TestData, any>[], optionsFn?: () => Partial<TableOptions<TestData>> )
| 317 | type TestData = { id: string; title: string } |
| 318 | |
| 319 | export function createTestTable( |
| 320 | data: TestData[], |
| 321 | columns: ColumnDef<TestData, any>[], |
| 322 | optionsFn?: () => Partial<TableOptions<TestData>> |
| 323 | ) { |
| 324 | @Component({ |
| 325 | template: ` |
| 326 | <table> |
| 327 | <thead data-testid="thead"> |
| 328 | @for (headerGroup of table.getHeaderGroups(); track headerGroup.id) { |
| 329 | <tr |
| 330 | data-testid="thead_row" |
| 331 | [attr.data-testid]="'thead_headergroup_' + headerGroup.id" |
| 332 | > |
| 333 | @for (header of headerGroup.headers; track header.id) { |
| 334 | @if (!header.isPlaceholder) { |
| 335 | <th |
| 336 | [attr.data-testid]=" |
| 337 | 'thead_headergroup_' + headerGroup.id + '_' + header.id |
| 338 | " |
| 339 | > |
| 340 | <ng-container |
| 341 | *flexRender=" |
| 342 | header.column.columnDef.header; |
| 343 | props: header.getContext(); |
| 344 | let header |
| 345 | " |
| 346 | > |
| 347 | <span [innerHTML]="header"></span> |
| 348 | </ng-container> |
| 349 | </th> |
| 350 | } |
| 351 | } |
| 352 | </tr> |
| 353 | } |
| 354 | </thead> |
| 355 | <tbody> |
| 356 | @for (row of table.getRowModel().rows; track row.id) { |
| 357 | <tr [attr.data-testid]="'row_' + row.id"> |
| 358 | @for (cell of row.getVisibleCells(); track cell.id) { |
| 359 | <td [attr.data-testid]="'row_' + row.id + '_cell_' + cell.id"> |
| 360 | <ng-container |
| 361 | *flexRender=" |
| 362 | cell.column.columnDef.cell; |
| 363 | props: cell.getContext(); |
| 364 | let cell |
| 365 | " |
| 366 | > |
| 367 | <span [innerHTML]="cell"></span> |
| 368 | </ng-container> |
| 369 | </td> |
| 370 | } |
| 371 | </tr> |
| 372 | } |
| 373 | </tbody> |
| 374 | </table> |
| 375 | |
| 376 | <button (click)="(0)">Trigger CD</button> |
no test coverage detected
searching dependent graphs…