Skip to content

Commit 1dda953

Browse files
authored
fix(ui5-table): fixes noData slot issue (#11397)
1 parent 84f8746 commit 1dda953

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

packages/main/cypress/specs/Table.cy.tsx

+20
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,26 @@ describe("Table - Rendering", () => {
6464
cy.wait(500);
6565
});
6666

67+
it("tests if table is rendered with no data slot", () => {
68+
cy.mount(
69+
<Table id="table">
70+
<TableHeaderRow slot="headerRow">
71+
<TableHeaderCell></TableHeaderCell>
72+
</TableHeaderRow>
73+
<div slot="noData" id="noData">
74+
<Label>No data found</Label>
75+
</div>
76+
</Table>
77+
);
78+
79+
cy.get("#table").shadow().find('slot[name=noData]').as("noDataSlot");
80+
cy.get("@noDataSlot").should("exist");
81+
cy.get("@noDataSlot").then(($noDataSlot) => {
82+
const noDataElement = ($noDataSlot[0] as HTMLSlotElement).assignedElements()[0];
83+
cy.wrap(noDataElement).should("have.attr", "id", "noData")
84+
});
85+
});
86+
6787
it("columns have equal widths width default width", () => {
6888
cy.mount(
6989
<Table style="width: 400px;" id="table">

packages/main/src/TableTemplate.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function TableTemplate(this: Table) {
2727
<TableRow id="no-data-row">
2828
<TableCell id="no-data-cell" data-excluded-from-navigation horizontal-align="Center">
2929
{ this.noData.length > 0 ?
30-
<slot name="no-data"></slot>
30+
<slot name="noData"></slot>
3131
:
3232
this._effectiveNoDataText
3333
}

packages/website/docs/_components_pages/main/Table/Table.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Enable a sticky header by utilizing the properties `sticky` and `sticky-top` of
4646

4747
### No Data
4848

49-
You can provide an illustration or a custom text, that is shown when the table has no data using the `no-data` slot.
49+
You can provide an illustration or a custom text, that is shown when the table has no data using the `noData` slot.
5050

5151
<NoDataSlot />
5252

packages/website/docs/_samples/main/Table/NoDataSlot/sample.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<body style="background-color: var(--sapBackgroundColor)">
1212
<!-- playground-fold-end -->
1313
<ui5-table id="table" overflow-mode="Popin">
14-
<ui5-illustrated-message slot="no-data" name="NoData"></ui5-illustrated-message>
14+
<ui5-illustrated-message slot="noData" name="NoData"></ui5-illustrated-message>
1515
<!-- playground-fold -->
1616
<ui5-table-header-row slot="headerRow">
1717
<ui5-table-header-cell id="produtCol" width="300px"><span>Product</span></ui5-table-header-cell>

0 commit comments

Comments
 (0)