-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathindex.spec.js
More file actions
97 lines (90 loc) · 2.23 KB
/
index.spec.js
File metadata and controls
97 lines (90 loc) · 2.23 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import { createElement } from 'lwc';
import Component from 'x/component';
import { ariaProperties } from '../../../helpers/utils.js';
// This list can grow as we add more properties to the base LightningElement
const expectedEnumerableProps = [
'accessKey',
'addEventListener',
'attachInternals',
'childNodes',
'children',
'classList',
'dir',
'dispatchEvent',
'draggable',
'firstChild',
'firstElementChild',
'getAttribute',
'getAttributeNS',
'getBoundingClientRect',
'getElementsByClassName',
'getElementsByTagName',
'hasAttribute',
'hasAttributeNS',
'hidden',
'hostElement',
'id',
'isConnected',
'lang',
'lastChild',
'lastElementChild',
'ownerDocument',
'querySelector',
'querySelectorAll',
'refs',
'removeAttribute',
'removeAttributeNS',
'removeEventListener',
'render',
'setAttribute',
'setAttributeNS',
'shadowRoot',
'spellcheck',
'style',
'tabIndex',
'tagName',
'template',
'title',
'toString',
...ariaProperties,
].sort();
const expectedEnumerableAndWritableProps = [
'addEventListener',
'attachInternals',
'dispatchEvent',
'getAttribute',
'getAttributeNS',
'getBoundingClientRect',
'getElementsByClassName',
'getElementsByTagName',
'hasAttribute',
'hasAttributeNS',
'querySelector',
'querySelectorAll',
'removeAttribute',
'removeAttributeNS',
'removeEventListener',
'render',
'setAttribute',
'setAttributeNS',
'toString',
];
describe('properties', () => {
let elm;
beforeEach(() => {
elm = createElement('x-component', { is: Component });
document.body.appendChild(elm);
});
it('has expected enumerable properties', () => {
const props = elm.getEnumerableProps();
expect(props).toEqual(expectedEnumerableProps);
});
it('has expected writable properties', () => {
const props = elm.getEnumerableAndWritableProps();
expect(props).toEqual(expectedEnumerableAndWritableProps);
});
it('has expected configurable properties', () => {
const props = elm.getEnumerableAndConfigurableProps();
expect(props).toEqual([]);
});
});