-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathindex.spec.js
More file actions
45 lines (39 loc) · 1.42 KB
/
index.spec.js
File metadata and controls
45 lines (39 loc) · 1.42 KB
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
41
42
43
44
45
import { createElement } from 'lwc';
import Test from 'x/test';
import { jasmine } from '../../../helpers/jasmine.js';
describe('event.composedPath() of event dispatched from closed shadow root', () => {
it('should have shadowed elements when invoked inside the shadow root', () => {
const elm = createElement('x-test', { is: Test });
document.body.appendChild(elm);
return Promise.resolve().then(() => {
elm.clickShadowedButton();
expect(elm.getShadowedComposedPath()).toEqual([
jasmine.any(HTMLElement), // button
jasmine.any(Object), // #shadow-root(closed)
elm.child,
elm.shadowRoot,
elm,
document.body,
document.documentElement,
document,
window,
]);
});
});
it('should not have shadowed elements when invoked outside the shadow root', () => {
const elm = createElement('x-test', { is: Test });
document.body.appendChild(elm);
return Promise.resolve().then(() => {
elm.clickShadowedButton();
expect(elm.getComposedPath()).toEqual([
elm.child,
elm.shadowRoot,
elm,
document.body,
document.documentElement,
document,
window,
]);
});
});
});