Skip to content

Commit

Permalink
fix: add falsy handling for async columnTemplate loading (#472)
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianjakobi authored Sep 17, 2024
1 parent 6d23ada commit c7c4adc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-container *ngIf="(displayedPageSize$ | async) as displayedPageSize">
<p-dataView
*ngIf="(columnTemplates$ | async) ?? [] as columnTemplates"
*ngIf="(columnTemplates$ | async) ?? {} as columnTemplates"
[value]="(displayedItems$ | async) ?? []"
[paginator]="paginator"
[first]="page * displayedPageSize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@

<ng-container *ngIf="(displayedPageSize$ | async) as displayedPageSize">
<p-table
*ngIf="(columnTemplates$ | async) as columnTemplates"
*ngIf="(columnTemplates$ | async) ?? {} as columnTemplates"
[value]="(displayedRows$ | async) ?? []"
responsiveLayout="scroll"
[paginator]="paginator"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,7 @@ describe('DataTableComponent', () => {
expect(component.editTableRowObserved).toBe(true)
expect(component.deleteTableRowObserved).toBe(true)

fixture.detectChanges()
await fixture.whenStable()


const tableActions = await dataTable.getActionButtons()
expect(tableActions.length).toBe(3)
Expand All @@ -502,8 +501,7 @@ describe('DataTableComponent', () => {
setUpActionButtonMockData()
component.viewActionEnabledField = 'ready'

fixture.detectChanges()
await fixture.whenStable()


let tableActions = await dataTable.getActionButtons()
expect(tableActions.length).toBe(3)
Expand All @@ -524,8 +522,7 @@ describe('DataTableComponent', () => {

component.rows = [...tempRows]

fixture.detectChanges()
await fixture.whenStable()


tableActions = await dataTable.getActionButtons()

Expand All @@ -546,8 +543,7 @@ describe('DataTableComponent', () => {
expect(component.viewTableRowObserved).toBe(true)
expect(component.editTableRowObserved).toBe(true)
expect(component.deleteTableRowObserved).toBe(true)
fixture.detectChanges()
await fixture.whenStable()


const tableActions = await dataTable.getActionButtons()
expect(tableActions.length).toBe(3)
Expand All @@ -569,8 +565,7 @@ describe('DataTableComponent', () => {
setUpActionButtonMockData()
component.viewActionVisibleField = 'ready'

fixture.detectChanges()
await fixture.whenStable()


let tableActions = await dataTable.getActionButtons()
expect(tableActions.length).toBe(2)
Expand All @@ -586,8 +581,7 @@ describe('DataTableComponent', () => {

component.rows = [...tempRows]

fixture.detectChanges()
await fixture.whenStable()


tableActions = await dataTable.getActionButtons()
expect(tableActions.length).toBe(3)
Expand Down

0 comments on commit c7c4adc

Please sign in to comment.