-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathsnackbar.test.ts
40 lines (34 loc) · 1.26 KB
/
snackbar.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
38
39
40
import "../snackbar";
import "../button";
import "../icon";
import { assignedNodesMap, createContainer, removeContainer, waitForElement } from "../../test/testing-helpers";
import { Snackbar } from "./snackbar";
describe("wl-snackbar", () => {
const { expect } = chai;
let $snackbar: Snackbar;
let $container: HTMLElement;
before(() => {
$container = createContainer();
});
beforeEach(async () => {
$container.innerHTML = `
<wl-snackbar>
<wl-icon slot="icon">account_box</wl-icon>
<wl-button slot="action" flat inverted>Continue as guest</wl-button>
<wl-button slot="action" flat inverted>Sign in</wl-button>
<span>Your password was updated on your other device. Please sign in again.</span>
</wl-snackbar>`;
await waitForElement("wl-snackbar");
$snackbar = $container.querySelector<Snackbar>("wl-snackbar")!;
});
after(() => removeContainer($container));
it("should render the slots", async () => {
const assignedNodes = assignedNodesMap($snackbar.shadowRoot!);
expect(assignedNodes["icon"].length).to.be.above(0);
expect(assignedNodes["action"].length).to.be.above(0);
expect(assignedNodes[""].length).to.be.above(0);
});
it("should have a banner role", () => {
expect($snackbar.getAttribute("role")).to.equal("banner");
});
});