-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmenu.options.test.basics.ts
40 lines (34 loc) · 1.1 KB
/
menu.options.test.basics.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 './menu.button.js';
import './menu.link.js';
import './menu.js';
import { expect, fixture, html } from '@open-wc/testing';
import { customElement } from 'lit/decorators.js';
import sinon from 'sinon';
import GlideCoreMenuOptions from './menu.options.js';
import expectUnhandledRejection from './library/expect-unhandled-rejection.js';
import expectWindowError from './library/expect-window-error.js';
@customElement('glide-core-subclassed')
class GlideCoreSubclassed extends GlideCoreMenuOptions {}
it('throws when subclassed', async () => {
const spy = sinon.spy();
try {
new GlideCoreSubclassed();
} catch {
spy();
}
expect(spy.callCount).to.equal(1);
});
it('throws when it does not have a default slot', async () => {
await expectUnhandledRejection(() => {
return fixture(html`<glide-core-menu-options></glide-core-menu-options>`);
});
});
it('throws when its default slot is the wrong type', async () => {
await expectWindowError(() => {
return fixture(
html`<glide-core-menu-options>
<option>Option</option>
</glide-core-menu-options>`,
);
});
});