forked from andreasbm/weightless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list-item.test.ts
38 lines (31 loc) · 1.06 KB
/
list-item.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import "../list-item";
import { assignedNodesMap, createContainer, removeContainer, waitForElement } from "../../test/testing-helpers";
import { ListItem } from "./list-item";
describe("wl-list-item", () => {
const {expect} = chai;
let $listItem: ListItem;
let $container: HTMLElement;
before(() => {
$container = createContainer();
});
beforeEach(async () => {
$container.innerHTML = `
<wl-list-item>
<div slot="before">Hello</div>
<div>Lorem ipsum</div>
<div slot="after">World</div>
</wl-list-item>`;
await waitForElement("wl-list-item");
$listItem = $container.querySelector<ListItem>("wl-list-item")!;
});
after(() => removeContainer($container));
it("should render the slots", async () => {
const assignedNodes = assignedNodesMap($listItem.shadowRoot!);
expect(assignedNodes["before"].length).to.be.above(0);
expect(assignedNodes[""].length).to.be.above(0);
expect(assignedNodes["after"].length).to.be.above(0);
});
it("should have a list item role", () => {
expect($listItem.getAttribute("role")).to.equal("listitem");
});
});