Skip to content

Commit

Permalink
fix TableListView empty view trapping users with no action to create …
Browse files Browse the repository at this point in the history
…new item (#109345) (#109663)

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Nathan Reese <[email protected]>
  • Loading branch information
kibanamachine and nreese authored Aug 23, 2021
1 parent bf9413d commit a6eb15a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ describe('TableListView', () => {
expect(component).toMatchSnapshot();
});

// avoid trapping users in empty prompt that can not create new items
test('render default empty prompt with create action when createItem supplied', async () => {
const component = shallowWithIntl(<TableListView {...requiredProps} createItem={() => {}} />);

// Using setState to check the final render while sidestepping the debounced promise management
component.setState({
hasInitialFetchReturned: true,
isFetchingItems: false,
});

expect(component).toMatchSnapshot();
});

test('render custom empty prompt', () => {
const component = shallowWithIntl(
<TableListView {...requiredProps} emptyPrompt={<EuiEmptyPrompt />} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ class TableListView extends React.Component<TableListViewProps, TableListViewSta
}
</h1>
}
actions={this.renderCreateButton()}
/>
);
}
Expand Down

0 comments on commit a6eb15a

Please sign in to comment.