@dile/utils 3.3.6 → 3.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -4
- package/components/country-select/country-select.spec.js +0 -35
- package/components/datepicker/calendar.spec.js +0 -136
- package/components/datepicker/datepicker.spec.js +0 -45
- package/components/datepicker/datetimepicker.spec.js +0 -55
- package/components/graph/graph.spec.js +0 -38
- package/components/html-transform/html-transform.spec.js +0 -25
- package/components/input-phone/__screenshots__/input-phone.spec.js/dile-input-phone-Rendering-preselects-the-prefix-of-the-country-attribute-1.png +0 -0
- package/components/input-phone/__screenshots__/input-phone.spec.js/dile-input-phone-Value-set-from-outside-keeps-the-country-when-it-shares-the-prefix-of-the-value-1.png +0 -0
- package/components/input-phone/__screenshots__/input-phone.spec.js/dile-input-phone-Value-with-prefix-does-not-let-the-prefix-selector-events-escape-as-the-field-own-events-1.png +0 -0
- package/components/input-phone/__screenshots__/input-phone.spec.js/dile-input-phone-Value-with-prefix-updates-the-value-when-the-user-chooses-a-prefix-1.png +0 -0
- package/components/input-phone/input-phone.spec.js +0 -345
- package/components/local-time/local-time.spec.js +0 -25
- package/components/media-query/media-query.spec.js +0 -34
- package/components/network/network.spec.js +0 -33
- package/components/phone-prefix-select/__screenshots__/phone-prefix-select.spec.js/dile-phone-prefix-select-Initial-value-and-country-ignores-a-country-that-does-not-match-the-prefix-1.png +0 -0
- package/components/phone-prefix-select/__screenshots__/phone-prefix-select.spec.js/dile-phone-prefix-select-Searching-compact-gives-the-selected-field-an-accessible-name-with-the-country-1.png +0 -0
- package/components/phone-prefix-select/phone-prefix-select.spec.js +0 -257
- package/components/qr-code/qr-code.spec.js +0 -164
- package/components/smooth-scroll/smooth-scroll.spec.js +0 -26
- package/components/time-duration/time-duration.spec.js +0 -68
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
-
import './input-phone.js';
|
|
3
|
-
|
|
4
|
-
describe('dile-input-phone', () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
document.body.innerHTML = '';
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
function wait(ms) {
|
|
10
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
async function render(attributes = '') {
|
|
14
|
-
document.body.innerHTML = `<dile-input-phone ${attributes}></dile-input-phone>`;
|
|
15
|
-
const el = document.body.querySelector('dile-input-phone');
|
|
16
|
-
await el.updateComplete;
|
|
17
|
-
await el.prefixSelect?.updateComplete;
|
|
18
|
-
return el;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function numberInput(el) {
|
|
22
|
-
return el.shadowRoot.getElementById('textField');
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function typeNumber(el, text) {
|
|
26
|
-
const input = numberInput(el);
|
|
27
|
-
input.value = text;
|
|
28
|
-
input.dispatchEvent(new Event('input', { bubbles: true }));
|
|
29
|
-
await el.updateComplete;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async function blurNumber(el) {
|
|
33
|
-
numberInput(el).dispatchEvent(new Event('blur'));
|
|
34
|
-
await el.updateComplete;
|
|
35
|
-
await el.prefixSelect?.updateComplete;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async function choosePrefix(el, keyword, optionText) {
|
|
39
|
-
const prefixSelect = el.prefixSelect;
|
|
40
|
-
const search = prefixSelect.shadowRoot.getElementById('search');
|
|
41
|
-
search.value = keyword;
|
|
42
|
-
search.dispatchEvent(new Event('input', { bubbles: true }));
|
|
43
|
-
await wait(20);
|
|
44
|
-
await prefixSelect.updateComplete;
|
|
45
|
-
const option = Array.from(prefixSelect.select.shadowRoot.querySelectorAll('[role="option"]'))
|
|
46
|
-
.find(o => o.textContent.trim() === optionText);
|
|
47
|
-
option.click();
|
|
48
|
-
await prefixSelect.select.updateComplete;
|
|
49
|
-
await prefixSelect.updateComplete;
|
|
50
|
-
await el.updateComplete;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
describe('Rendering', () => {
|
|
54
|
-
it('renders the prefix selector and a tel input', async () => {
|
|
55
|
-
const el = await render('label="Phone"');
|
|
56
|
-
|
|
57
|
-
expect(el.prefixSelect).toBeTruthy();
|
|
58
|
-
const input = numberInput(el);
|
|
59
|
-
expect(input.type).toBe('tel');
|
|
60
|
-
expect(input.getAttribute('inputmode')).toBe('tel');
|
|
61
|
-
expect(input.getAttribute('autocomplete')).toBe('tel-national');
|
|
62
|
-
expect(el.shadowRoot.querySelector('label').textContent).toBe('Phone');
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('does not render the prefix selector with noPrefix', async () => {
|
|
66
|
-
const el = await render('noPrefix');
|
|
67
|
-
|
|
68
|
-
expect(el.prefixSelect).toBeNull();
|
|
69
|
-
expect(numberInput(el).getAttribute('autocomplete')).toBe('tel');
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('preselects the prefix of the country attribute', async () => {
|
|
73
|
-
const el = await render('country="ES"');
|
|
74
|
-
|
|
75
|
-
expect(el.prefix).toBe('+34');
|
|
76
|
-
expect(el.prefixSelect.value).toBe('+34');
|
|
77
|
-
// Compact: only the prefix once selected, to leave room for the number
|
|
78
|
-
expect(el.prefixSelect.selectedText).toBe('+34');
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('screen readers get the country of the compact prefix', async () => {
|
|
82
|
-
const el = await render('country="ES"');
|
|
83
|
-
const input = el.prefixSelect.shadowRoot.getElementById('result').shadowRoot.querySelector('input');
|
|
84
|
-
|
|
85
|
-
expect(input.getAttribute('aria-label')).toBe('+34 Spain');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('lets the prefix list be wider than the narrow prefix box', async () => {
|
|
89
|
-
const el = await render();
|
|
90
|
-
const overlay = el.prefixSelect.select.shadowRoot.getElementById('overlay');
|
|
91
|
-
|
|
92
|
-
expect(getComputedStyle(overlay).minWidth).toBe('256px');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('passes language to the prefix selector, with a short placeholder', async () => {
|
|
96
|
-
const el = await render('language="es"');
|
|
97
|
-
|
|
98
|
-
expect(el.prefixSelect.language).toBe('es');
|
|
99
|
-
expect(el.prefixSelect.shadowRoot.getElementById('search').placeholder).toBe('Prefijo');
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe('Value with prefix', () => {
|
|
104
|
-
it('combines the selected prefix and the typed number in E.164 format', async () => {
|
|
105
|
-
const el = await render('country="ES" name="phone"');
|
|
106
|
-
let detail = null;
|
|
107
|
-
el.addEventListener('element-changed', (e) => { detail = e.detail; });
|
|
108
|
-
|
|
109
|
-
await typeNumber(el, '600 12 34 56');
|
|
110
|
-
|
|
111
|
-
expect(el.value).toBe('+34600123456');
|
|
112
|
-
expect(el.number).toBe('600123456');
|
|
113
|
-
expect(detail).toEqual({ name: 'phone', value: '+34600123456' });
|
|
114
|
-
// The field keeps what the user typed
|
|
115
|
-
expect(numberInput(el).value).toBe('600 12 34 56');
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('updates the value when the user chooses a prefix', async () => {
|
|
119
|
-
const el = await render();
|
|
120
|
-
await typeNumber(el, '612345678');
|
|
121
|
-
expect(el.value).toBe('612345678');
|
|
122
|
-
|
|
123
|
-
await choosePrefix(el, 'portugal', '+351 Portugal');
|
|
124
|
-
|
|
125
|
-
expect(el.country).toBe('PT');
|
|
126
|
-
expect(el.value).toBe('+351612345678');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('does not let the prefix selector events escape as the field own events', async () => {
|
|
130
|
-
const el = await render();
|
|
131
|
-
const names = [];
|
|
132
|
-
el.addEventListener('element-changed', (e) => names.push(e.detail.name));
|
|
133
|
-
document.body.addEventListener('dile-phone-prefix-changed', () => names.push('leaked'));
|
|
134
|
-
|
|
135
|
-
await choosePrefix(el, 'spain', '+34 Spain');
|
|
136
|
-
|
|
137
|
-
expect(names.includes('leaked')).toBe(false);
|
|
138
|
-
expect(names.every(name => name === el.name)).toBe(true);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('accepts a full international number typed in the field and moves the prefix to the selector on blur', async () => {
|
|
142
|
-
const el = await render();
|
|
143
|
-
|
|
144
|
-
await typeNumber(el, '+44 7700 900123');
|
|
145
|
-
expect(el.value).toBe('+447700900123');
|
|
146
|
-
|
|
147
|
-
await blurNumber(el);
|
|
148
|
-
|
|
149
|
-
expect(el.country).toBe('GB');
|
|
150
|
-
expect(numberInput(el).value).toBe('7700900123');
|
|
151
|
-
expect(el.value).toBe('+447700900123');
|
|
152
|
-
expect(el.prefixSelect.value).toBe('+44');
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('understands the 00 international prefix', async () => {
|
|
156
|
-
const el = await render();
|
|
157
|
-
|
|
158
|
-
await typeNumber(el, '0034600123456');
|
|
159
|
-
|
|
160
|
-
expect(el.value).toBe('+34600123456');
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it('removes characters that are not used in phone numbers', async () => {
|
|
164
|
-
const el = await render('country="ES"');
|
|
165
|
-
|
|
166
|
-
await typeNumber(el, '600abc123');
|
|
167
|
-
|
|
168
|
-
expect(numberInput(el).value).toBe('600123');
|
|
169
|
-
expect(el.value).toBe('+34600123');
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
it('a country set from outside changes the prefix of the typed number', async () => {
|
|
173
|
-
const el = await render('country="ES"');
|
|
174
|
-
await typeNumber(el, '600123456');
|
|
175
|
-
|
|
176
|
-
el.country = 'FR';
|
|
177
|
-
await el.updateComplete;
|
|
178
|
-
|
|
179
|
-
expect(el.value).toBe('+33600123456');
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
describe('Value set from outside', () => {
|
|
184
|
-
it('splits an initial international value into prefix and number', async () => {
|
|
185
|
-
const el = await render('value="+34600123456"');
|
|
186
|
-
|
|
187
|
-
expect(el.country).toBe('ES');
|
|
188
|
-
expect(el.prefix).toBe('+34');
|
|
189
|
-
expect(numberInput(el).value).toBe('600123456');
|
|
190
|
-
expect(el.prefixSelect.value).toBe('+34');
|
|
191
|
-
expect(el.value).toBe('+34600123456');
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('keeps the country when it shares the prefix of the value', async () => {
|
|
195
|
-
const el = await render('value="+15145550199" country="CA"');
|
|
196
|
-
|
|
197
|
-
expect(el.country).toBe('CA');
|
|
198
|
-
expect(el.prefixSelect.selectedText).toBe('+1');
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
it('uses the main country of a shared prefix', async () => {
|
|
202
|
-
const el = await render('value="+15555550199"');
|
|
203
|
-
|
|
204
|
-
expect(el.country).toBe('US');
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('keeps an unknown or national value as typed, without rewriting it', async () => {
|
|
208
|
-
const el = await render('country="ES" value="600123456"');
|
|
209
|
-
|
|
210
|
-
expect(numberInput(el).value).toBe('600123456');
|
|
211
|
-
expect(el.value).toBe('600123456');
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
it('parses values set later, as DileForm does', async () => {
|
|
215
|
-
const el = await render();
|
|
216
|
-
|
|
217
|
-
el.value = '+351912345678';
|
|
218
|
-
await el.updateComplete;
|
|
219
|
-
|
|
220
|
-
expect(el.country).toBe('PT');
|
|
221
|
-
expect(numberInput(el).value).toBe('912345678');
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it('clear() empties the number and restores the initial country', async () => {
|
|
225
|
-
const el = await render('country="ES"');
|
|
226
|
-
el.value = '+447700900123';
|
|
227
|
-
await el.updateComplete;
|
|
228
|
-
expect(el.country).toBe('GB');
|
|
229
|
-
|
|
230
|
-
el.clear();
|
|
231
|
-
await el.updateComplete;
|
|
232
|
-
|
|
233
|
-
expect(el.value).toBe('');
|
|
234
|
-
expect(numberInput(el).value).toBe('');
|
|
235
|
-
expect(el.country).toBe('ES');
|
|
236
|
-
|
|
237
|
-
// A value set after clear() is still parsed
|
|
238
|
-
el.value = '+33612345678';
|
|
239
|
-
await el.updateComplete;
|
|
240
|
-
expect(el.country).toBe('FR');
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
it('clearing the value removes the prefix when there was no initial country', async () => {
|
|
244
|
-
const el = await render('value="+34600123456"');
|
|
245
|
-
|
|
246
|
-
el.clear();
|
|
247
|
-
await el.updateComplete;
|
|
248
|
-
await el.prefixSelect.updateComplete;
|
|
249
|
-
|
|
250
|
-
expect(el.country).toBeUndefined();
|
|
251
|
-
expect(el.prefixSelect.value).toBeUndefined();
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
describe('noPrefix', () => {
|
|
256
|
-
it('the value is the typed number without separators', async () => {
|
|
257
|
-
const el = await render('noPrefix');
|
|
258
|
-
|
|
259
|
-
await typeNumber(el, '(600) 12-34-56');
|
|
260
|
-
|
|
261
|
-
expect(el.value).toBe('600123456');
|
|
262
|
-
expect(el.prefix).toBeUndefined();
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
it('keeps an international number typed by the user', async () => {
|
|
266
|
-
const el = await render('noPrefix');
|
|
267
|
-
|
|
268
|
-
await typeNumber(el, '+34 600 123 456');
|
|
269
|
-
|
|
270
|
-
expect(el.value).toBe('+34600123456');
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
it('shows a value set from outside as is', async () => {
|
|
274
|
-
const el = await render('noPrefix value="+34600123456"');
|
|
275
|
-
|
|
276
|
-
expect(numberInput(el).value).toBe('+34600123456');
|
|
277
|
-
});
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
describe('isValid()', () => {
|
|
281
|
-
it('an empty value is valid', async () => {
|
|
282
|
-
const el = await render();
|
|
283
|
-
expect(el.isValid()).toBe(true);
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
it('with prefix requires an international number', async () => {
|
|
287
|
-
const el = await render();
|
|
288
|
-
|
|
289
|
-
await typeNumber(el, '600123456');
|
|
290
|
-
expect(el.isValid()).toBe(false);
|
|
291
|
-
|
|
292
|
-
el.country = 'ES';
|
|
293
|
-
await el.updateComplete;
|
|
294
|
-
expect(el.isValid()).toBe(true);
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
it('rejects too short or too long numbers', async () => {
|
|
298
|
-
const el = await render('country="ES"');
|
|
299
|
-
|
|
300
|
-
await typeNumber(el, '12');
|
|
301
|
-
expect(el.isValid()).toBe(false);
|
|
302
|
-
|
|
303
|
-
await typeNumber(el, '1234567890123456');
|
|
304
|
-
expect(el.isValid()).toBe(false);
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
it('without prefix checks only the length', async () => {
|
|
308
|
-
const el = await render('noPrefix');
|
|
309
|
-
|
|
310
|
-
await typeNumber(el, '600123456');
|
|
311
|
-
expect(el.isValid()).toBe(true);
|
|
312
|
-
|
|
313
|
-
await typeNumber(el, '12');
|
|
314
|
-
expect(el.isValid()).toBe(false);
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
describe('States and forms', () => {
|
|
319
|
-
it('applies errored and disabled to the prefix selector and the input', async () => {
|
|
320
|
-
const el = await render('errored disabled message="Wrong phone"');
|
|
321
|
-
|
|
322
|
-
expect(el.prefixSelect.errored).toBe(true);
|
|
323
|
-
expect(el.prefixSelect.disabled).toBe(true);
|
|
324
|
-
expect(numberInput(el).disabled).toBe(true);
|
|
325
|
-
expect(el.shadowRoot.querySelector('.message').textContent.trim()).toBe('Wrong phone');
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
it('hideErrorOnInput clears the error when typing', async () => {
|
|
329
|
-
const el = await render('errored message="Wrong phone" hideErrorOnInput');
|
|
330
|
-
|
|
331
|
-
await typeNumber(el, '6');
|
|
332
|
-
|
|
333
|
-
expect(el.errored).toBe(false);
|
|
334
|
-
expect(el.message).toBe('');
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
it('is form-associated with the full number as form value', async () => {
|
|
338
|
-
document.body.innerHTML = '<form><dile-input-phone name="phone" value="+34600123456"></dile-input-phone></form>';
|
|
339
|
-
const el = document.body.querySelector('dile-input-phone');
|
|
340
|
-
await el.updateComplete;
|
|
341
|
-
|
|
342
|
-
expect(new FormData(document.body.querySelector('form')).get('phone')).toBe('+34600123456');
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
-
import './local-time.js';
|
|
3
|
-
|
|
4
|
-
describe('dile-local-time', () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
document.body.innerHTML = '';
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
async function renderLocalTime(html) {
|
|
10
|
-
document.body.innerHTML = html;
|
|
11
|
-
const el = document.body.querySelector('dile-local-time');
|
|
12
|
-
await el.updateComplete;
|
|
13
|
-
return el;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
it('renders the formatted local time from isoDatetime', async () => {
|
|
17
|
-
const el = await renderLocalTime('<dile-local-time isoDatetime="2024-01-15T10:30:00Z"></dile-local-time>');
|
|
18
|
-
expect(el.shadowRoot.textContent.trim().length).toBeGreaterThan(0);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('renders empty when isoDatetime is not set', async () => {
|
|
22
|
-
const el = await renderLocalTime('<dile-local-time></dile-local-time>');
|
|
23
|
-
expect(el.shadowRoot.textContent.trim()).toBe('');
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
-
import './media-query.js';
|
|
3
|
-
|
|
4
|
-
describe('dile-media-query', () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
document.body.innerHTML = '';
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
async function renderMediaQuery(html) {
|
|
10
|
-
document.body.innerHTML = html;
|
|
11
|
-
const el = document.body.querySelector('dile-media-query');
|
|
12
|
-
await el.updateComplete;
|
|
13
|
-
return el;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
it('renders without throwing and creates a matcher for the query', async () => {
|
|
17
|
-
const el = await renderMediaQuery('<dile-media-query query="(min-width: 10px)"></dile-media-query>');
|
|
18
|
-
await el.updateComplete;
|
|
19
|
-
expect(el.matcher).toBeInstanceOf(MediaQueryList);
|
|
20
|
-
expect(el._match).toBe(true);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it('dispatches dile-media-query-changed when the match state is set', async () => {
|
|
24
|
-
const el = await renderMediaQuery('<dile-media-query query="(min-width: 10px)"></dile-media-query>');
|
|
25
|
-
let detail = null;
|
|
26
|
-
el.addEventListener('dile-media-query-changed', (e) => { detail = e.detail; });
|
|
27
|
-
|
|
28
|
-
el.query = '(max-width: 5px)';
|
|
29
|
-
await el.updateComplete;
|
|
30
|
-
await el.updateComplete;
|
|
31
|
-
|
|
32
|
-
expect(detail).toEqual({ value: false });
|
|
33
|
-
});
|
|
34
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, afterEach } from 'vitest';
|
|
2
|
-
import './network.js';
|
|
3
|
-
|
|
4
|
-
describe('dile-network', () => {
|
|
5
|
-
afterEach(() => {
|
|
6
|
-
document.body.innerHTML = '';
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
async function renderNetwork(html) {
|
|
10
|
-
document.body.innerHTML = html;
|
|
11
|
-
const el = document.body.querySelector('dile-network');
|
|
12
|
-
await el.updateComplete;
|
|
13
|
-
return el;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
it('reflects the current navigator.onLine status', async () => {
|
|
17
|
-
const el = await renderNetwork('<dile-network></dile-network>');
|
|
18
|
-
expect(el.onLine).toBe(window.navigator.onLine);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it('does not render the offline toast when online and showOffLineStatus is unset', async () => {
|
|
22
|
-
const el = await renderNetwork('<dile-network></dile-network>');
|
|
23
|
-
expect(el.shadowRoot.querySelector('#eltoast')).toBeNull();
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('renders the offline toast when forced offline with showOffLineStatus', async () => {
|
|
27
|
-
const el = await renderNetwork('<dile-network showOffLineStatus></dile-network>');
|
|
28
|
-
el.onLine = false;
|
|
29
|
-
await el.updateComplete;
|
|
30
|
-
|
|
31
|
-
expect(el.shadowRoot.querySelector('#eltoast')).toBeTruthy();
|
|
32
|
-
});
|
|
33
|
-
});
|