|
1 | 1 | import Tree from "../../src/Tree.js";
|
2 | 2 | import "../../src/TreeItem.js";
|
| 3 | +import TreeItem from "../../src/TreeItem.js"; |
| 4 | +import Icon from "../../src/Icon.js"; |
| 5 | +import bell from "@ui5/webcomponents-icons/dist/bell.js"; |
3 | 6 |
|
4 | 7 | describe("Tree Tests", () => {
|
5 | 8 | it("tests accessibility properties forwarded to the list", () => {
|
@@ -27,6 +30,27 @@ describe("Tree Tests", () => {
|
27 | 30 | .and("have.attr", "accessible-description", "Description")
|
28 | 31 | .and("have.attr", "accessible-description-ref", "lblDesc2");
|
29 | 32 | });
|
| 33 | + |
| 34 | + it("Tests image slot", () => { |
| 35 | + cy.mount( |
| 36 | + <Tree> |
| 37 | + <TreeItem id="image-slot-tree-item"> |
| 38 | + <Icon name={bell} slot="image" id="slotted-icon"></Icon> |
| 39 | + </TreeItem> |
| 40 | + </Tree> |
| 41 | + ); |
| 42 | + |
| 43 | + cy.get("#image-slot-tree-item") |
| 44 | + .shadow() |
| 45 | + .find("slot[name='image']") |
| 46 | + .should("exist") |
| 47 | + .then($slot => { |
| 48 | + const slotElement = $slot[0] as HTMLSlotElement; |
| 49 | + const assignedNodes = slotElement.assignedNodes(); |
| 50 | + expect(assignedNodes.length).to.be.greaterThan(0); |
| 51 | + cy.wrap(assignedNodes[0]).should("have.attr", "id", "slotted-icon"); |
| 52 | + }); |
| 53 | + }); |
30 | 54 | });
|
31 | 55 |
|
32 | 56 | describe("Tree Props", () => {
|
|
0 commit comments