@lion/ui 0.8.8 → 0.9.1
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/components/combobox/src/LionCombobox.js +6 -2
- package/components/combobox/test/lion-combobox.test.js +56 -3
- package/components/core/src/DisabledMixin.js +6 -0
- package/components/core/test/DisabledMixin.test.js +22 -1
- package/components/core/test/SlotMixin.test.js +3 -3
- package/components/form-core/test/FocusMixin.test.js +6 -4
- package/components/form-core/test-suites/NativeTextFieldMixin.suite.js +4 -8
- package/components/form-integrations/test/form-integrations.test.js +2 -2
- package/components/input-datepicker/translations/es.js +1 -1
- package/components/input-stepper/src/LionInputStepper.js +110 -35
- package/components/input-stepper/test/lion-input-stepper.test.js +96 -1
- package/components/input-tel-dropdown/src/LionInputTelDropdown.js +7 -6
- package/components/input-tel-dropdown/test/LionInputTelDropdown.test.js +62 -10
- package/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.js +16 -12
- package/components/overlays/src/OverlayController.js +9 -0
- package/components/overlays/test/OverlayController.test.js +27 -3
- package/components/select-rich/test/lion-select-rich.test.js +9 -8
- package/components/switch/test/lion-switch.test.js +1 -1
- package/components/tabs/test/lion-tabs.test.js +12 -5
- package/custom-elements.json +506 -69
- package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
- package/dist-types/components/core/src/DisabledMixin.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/NativeTextFieldMixin.suite.d.ts.map +1 -1
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts +33 -24
- package/dist-types/components/input-stepper/src/LionInputStepper.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/src/LionInputTelDropdown.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/test/LionInputTelDropdown.test.d.ts +2 -2
- package/dist-types/components/input-tel-dropdown/test/LionInputTelDropdown.test.d.ts.map +1 -1
- package/dist-types/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.d.ts +2 -2
- package/dist-types/components/input-tel-dropdown/test-suites/LionInputTelDropdown.suite.d.ts.map +1 -1
- package/dist-types/components/overlays/src/OverlayController.d.ts.map +1 -1
- package/dist-types/components/tabs/test/lion-tabs.test.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/button/api-table.md +3 -0
- package/docs/components/checkbox-group/api-table.md +3 -0
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/api-table.md +1 -0
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +1 -1
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/api-table.md +1 -0
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/form/use-cases.md +2 -2
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/api-table.md +1 -0
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/api-table.md +1 -0
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/api-table.md +1 -0
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-datepicker/api-table.md +1 -0
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-email/api-table.md +1 -0
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/api-table.md +1 -0
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/api-table.md +1 -0
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/api-table.md +1 -0
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/api-table.md +7 -3
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-stepper/use-cases.md +30 -0
- package/docs/components/input-tel/api-table.md +1 -0
- package/docs/components/input-tel/overview.md +1 -1
- package/docs/components/input-tel/use-cases.md +6 -6
- package/docs/components/input-tel-dropdown/api-table.md +1 -0
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/listbox/api-table.md +2 -0
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/radio-group/api-table.md +2 -0
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/api-table.md +1 -0
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/api-table.md +2 -0
- package/docs/components/select-rich/use-cases.md +1 -1
- package/docs/components/switch/api-table.md +2 -0
- package/docs/components/tabs/examples.md +1 -1
- package/docs/components/textarea/api-table.md +1 -0
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
- package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
- package/docs/fundamentals/rationales/accessibility.md +1 -1
- package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
- package/docs/fundamentals/systems/core/overview.md +1 -1
- package/docs/fundamentals/systems/form/api-table.md +1 -0
- package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
- package/docs/fundamentals/systems/form/model-value.md +1 -1
- package/docs/fundamentals/systems/form/overview.md +28 -28
- package/docs/fundamentals/systems/form/validate.md +2 -2
- package/docs/fundamentals/systems/localize/overview.md +4 -4
- package/docs/fundamentals/systems/overlays/configuration.md +2 -2
- package/docs/fundamentals/systems/overlays/overview.md +5 -5
- package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
- package/docs/fundamentals/tools/helpers/overview.md +1 -1
- package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
- package/docs/guides/how-to/create-a-custom-field.md +5 -5
- package/docs/guides/how-to/create-a-form.md +4 -4
- package/docs/guides/how-to/extend-a-native-input.md +2 -2
- package/docs/guides/index.md +8 -8
- package/docs/guides/principles/index.md +5 -5
- package/docs/guides/principles/styling.md +1 -1
- package/package.json +1 -1
|
@@ -1,20 +1,24 @@
|
|
|
1
|
+
import { mimicUserChangingDropdown } from '@lion/ui/input-tel-dropdown-test-helpers.js';
|
|
2
|
+
import { runInputTelDropdownSuite } from '@lion/ui/input-tel-dropdown-test-suites.js';
|
|
3
|
+
import { LionInputTelDropdown } from '@lion/ui/input-tel-dropdown.js';
|
|
1
4
|
import { runInputTelSuite } from '@lion/ui/input-tel-test-suites.js';
|
|
5
|
+
import { aTimeout, expect, fixture } from '@open-wc/testing';
|
|
6
|
+
import { LionSelectRich } from '@lion/ui/select-rich.js';
|
|
2
7
|
import { repeat } from 'lit/directives/repeat.js';
|
|
8
|
+
import { LionOption } from '@lion/ui/listbox.js';
|
|
3
9
|
import { ref } from 'lit/directives/ref.js';
|
|
4
10
|
import { html } from 'lit';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { LionSelectRich } from '@lion/ui/select-rich.js';
|
|
9
|
-
import { runInputTelDropdownSuite } from '@lion/ui/input-tel-dropdown-test-suites.js';
|
|
10
|
-
import { mimicUserChangingDropdown } from '@lion/ui/input-tel-dropdown-test-helpers.js';
|
|
11
|
+
|
|
12
|
+
import { mockPhoneUtilManager, restorePhoneUtilManager } from '@lion/ui/input-tel-test-helpers.js';
|
|
13
|
+
import { isActiveElement } from '../../core/test-helpers/isActiveElement.js';
|
|
11
14
|
import { ScopedElementsMixin } from '../../core/src/ScopedElementsMixin.js';
|
|
15
|
+
import '@lion/ui/define/lion-input-tel-dropdown.js';
|
|
12
16
|
|
|
13
17
|
/**
|
|
14
|
-
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
15
|
-
* @typedef {HTMLSelectElement|HTMLElement & {modelValue:string}} DropdownElement
|
|
16
18
|
* @typedef {import('../types/index.js').TemplateDataForDropdownInputTel} TemplateDataForDropdownInputTel
|
|
19
|
+
* @typedef {HTMLSelectElement|HTMLElement & {modelValue:string}} DropdownElement
|
|
17
20
|
* @typedef {import('../types/index.js').RegionMeta} RegionMeta
|
|
21
|
+
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
18
22
|
*/
|
|
19
23
|
|
|
20
24
|
class WithFormControlInputTelDropdown extends ScopedElementsMixin(LionInputTelDropdown) {
|
|
@@ -65,6 +69,18 @@ describe('WithFormControlInputTelDropdown', () => {
|
|
|
65
69
|
// Runs it for LionSelectRich, which uses .modelValue/@model-value-changed instead of .value/@change
|
|
66
70
|
runInputTelDropdownSuite({ klass: WithFormControlInputTelDropdown });
|
|
67
71
|
|
|
72
|
+
it("it doesn't set the country as modelValue, only as viewValue", async () => {
|
|
73
|
+
const el = /** @type {LionInputTelDropdown} */ (
|
|
74
|
+
await fixture(html`
|
|
75
|
+
<lion-input-tel-dropdown .allowedRegions="${['NL']}"></lion-input-tel-dropdown>
|
|
76
|
+
`)
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
// @ts-expect-error [allow-protected-in-tests]
|
|
80
|
+
expect(el._inputNode.value).to.equal('+31');
|
|
81
|
+
expect(el.modelValue).to.equal('');
|
|
82
|
+
});
|
|
83
|
+
|
|
68
84
|
it('focuses the textbox right after selection if selected via opened dropdown if interaction-mode is mac', async () => {
|
|
69
85
|
class InputTelDropdownMac extends LionInputTelDropdown {
|
|
70
86
|
static templates = {
|
|
@@ -114,7 +130,7 @@ describe('WithFormControlInputTelDropdown', () => {
|
|
|
114
130
|
await el.updateComplete;
|
|
115
131
|
await aTimeout(0);
|
|
116
132
|
// @ts-expect-error [allow-protected-in-tests]
|
|
117
|
-
expect(el._inputNode).to.
|
|
133
|
+
expect(isActiveElement(el._inputNode)).to.be.true;
|
|
118
134
|
}
|
|
119
135
|
});
|
|
120
136
|
|
|
@@ -167,7 +183,43 @@ describe('WithFormControlInputTelDropdown', () => {
|
|
|
167
183
|
await el.updateComplete;
|
|
168
184
|
await aTimeout(0);
|
|
169
185
|
// @ts-expect-error [allow-protected-in-tests]
|
|
170
|
-
expect(el._inputNode).to.
|
|
186
|
+
expect(isActiveElement(el._inputNode)).to.be.false;
|
|
171
187
|
}
|
|
172
188
|
});
|
|
189
|
+
|
|
190
|
+
describe('defaultValidators', () => {
|
|
191
|
+
/** @type {(value:any) => void} */
|
|
192
|
+
let resolveLoaded;
|
|
193
|
+
beforeEach(() => {
|
|
194
|
+
({ resolveLoaded } = mockPhoneUtilManager());
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
afterEach(() => {
|
|
198
|
+
restorePhoneUtilManager();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('without interaction are not called', async () => {
|
|
202
|
+
const el = /** @type {LionInputTelDropdown} */ (
|
|
203
|
+
await fixture(html`
|
|
204
|
+
<lion-input-tel-dropdown .allowedRegions="${['NL']}"></lion-input-tel-dropdown>
|
|
205
|
+
`)
|
|
206
|
+
);
|
|
207
|
+
resolveLoaded(undefined);
|
|
208
|
+
await aTimeout(0);
|
|
209
|
+
expect(el.hasFeedbackFor).to.deep.equal([]);
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it('with interaction are called', async () => {
|
|
213
|
+
const el = /** @type {LionInputTelDropdown} */ (
|
|
214
|
+
await fixture(html`
|
|
215
|
+
<lion-input-tel-dropdown .allowedRegions="${['NL']}"></lion-input-tel-dropdown>
|
|
216
|
+
`)
|
|
217
|
+
);
|
|
218
|
+
el.modelValue = '+31 6';
|
|
219
|
+
|
|
220
|
+
resolveLoaded(undefined);
|
|
221
|
+
await aTimeout(0);
|
|
222
|
+
expect(el.hasFeedbackFor).to.deep.equal(['error']);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
173
225
|
});
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { PhoneUtilManager } from '@lion/ui/input-tel.js';
|
|
2
1
|
import { mockPhoneUtilManager, restorePhoneUtilManager } from '@lion/ui/input-tel-test-helpers.js';
|
|
2
|
+
import { mimicUserChangingDropdown } from '@lion/ui/input-tel-dropdown-test-helpers.js';
|
|
3
|
+
import { LionInputTelDropdown } from '@lion/ui/input-tel-dropdown.js';
|
|
4
|
+
import { PhoneUtilManager } from '@lion/ui/input-tel.js';
|
|
5
|
+
import sinon from 'sinon';
|
|
3
6
|
import {
|
|
7
|
+
fixtureSync as _fixtureSync,
|
|
8
|
+
fixture as _fixture,
|
|
9
|
+
unsafeStatic,
|
|
4
10
|
aTimeout,
|
|
5
11
|
defineCE,
|
|
6
12
|
expect,
|
|
7
|
-
fixture as _fixture,
|
|
8
|
-
fixtureSync as _fixtureSync,
|
|
9
13
|
html,
|
|
10
|
-
unsafeStatic,
|
|
11
14
|
} from '@open-wc/testing';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
import { mimicUserChangingDropdown } from '@lion/ui/input-tel-dropdown-test-helpers.js';
|
|
15
|
+
|
|
16
|
+
import { isActiveElement } from '../../core/test-helpers/isActiveElement.js';
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
|
-
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
18
|
-
* @typedef {HTMLSelectElement|HTMLElement & {modelValue:string}} DropdownElement
|
|
19
19
|
* @typedef {import('../types/index.js').TemplateDataForDropdownInputTel} TemplateDataForDropdownInputTel
|
|
20
|
+
* @typedef {HTMLSelectElement|HTMLElement & {modelValue:string}} DropdownElement
|
|
21
|
+
* @typedef {import('lit').TemplateResult} TemplateResult
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
24
|
const fixture = /** @type {(arg: string | TemplateResult) => Promise<LionInputTelDropdown>} */ (
|
|
@@ -206,12 +208,14 @@ export function runInputTelDropdownSuite({ klass } = { klass: LionInputTelDropdo
|
|
|
206
208
|
|
|
207
209
|
it('syncs disabled attribute to dropdown', async () => {
|
|
208
210
|
const el = await fixture(html` <${tag} disabled></${tag}> `);
|
|
209
|
-
expect(el.refs.dropdown.value?.hasAttribute('disabled')).to.be
|
|
211
|
+
expect(/** @type {HTMLElement} */ (el.refs.dropdown.value)?.hasAttribute('disabled')).to.be
|
|
212
|
+
.true;
|
|
210
213
|
});
|
|
211
214
|
|
|
212
215
|
it('disables dropdown on readonly', async () => {
|
|
213
216
|
const el = await fixture(html` <${tag} readonly></${tag}> `);
|
|
214
|
-
expect(el.refs.dropdown.value?.hasAttribute('disabled')).to.be
|
|
217
|
+
expect(/** @type {HTMLElement} */ (el.refs.dropdown.value)?.hasAttribute('disabled')).to.be
|
|
218
|
+
.true;
|
|
215
219
|
});
|
|
216
220
|
|
|
217
221
|
it('renders to prefix slot in light dom', async () => {
|
|
@@ -332,7 +336,7 @@ export function runInputTelDropdownSuite({ klass } = { klass: LionInputTelDropdo
|
|
|
332
336
|
mimicUserChangingDropdown(dropdownElement, 'BE');
|
|
333
337
|
await el.updateComplete;
|
|
334
338
|
// @ts-expect-error [allow-protected-in-tests]
|
|
335
|
-
expect(el._inputNode).to.
|
|
339
|
+
expect(isActiveElement(el._inputNode)).to.be.false;
|
|
336
340
|
});
|
|
337
341
|
});
|
|
338
342
|
|
|
@@ -1121,6 +1121,15 @@ export class OverlayController extends EventTarget {
|
|
|
1121
1121
|
if (this.manager) {
|
|
1122
1122
|
this.manager.disableTrapsKeyboardFocusForAll();
|
|
1123
1123
|
}
|
|
1124
|
+
|
|
1125
|
+
const isContentShadowHost = Boolean(this.contentNode.shadowRoot);
|
|
1126
|
+
if (isContentShadowHost) {
|
|
1127
|
+
// eslint-disable-next-line no-console
|
|
1128
|
+
console.warn(
|
|
1129
|
+
'[overlays]: For best accessibility (compatibility with Safari + VoiceOver), provide a contentNode that is not a host for a shadow root',
|
|
1130
|
+
);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1124
1133
|
this._containFocusHandler = containFocus(this.contentNode);
|
|
1125
1134
|
this.__hasActiveTrapsKeyboardFocus = true;
|
|
1126
1135
|
if (this.manager) {
|
|
@@ -603,8 +603,8 @@ describe('OverlayController', () => {
|
|
|
603
603
|
event.keyCode = keyCodes.tab;
|
|
604
604
|
window.dispatchEvent(event);
|
|
605
605
|
|
|
606
|
-
expect(elOutside).to.
|
|
607
|
-
expect(input1).to.
|
|
606
|
+
expect(isActiveElement(elOutside)).to.be.false;
|
|
607
|
+
expect(isActiveElement(input1)).to.be.true;
|
|
608
608
|
});
|
|
609
609
|
|
|
610
610
|
it('allows to move the focus outside of the overlay if trapsKeyboardFocus is disabled', async () => {
|
|
@@ -625,7 +625,7 @@ describe('OverlayController', () => {
|
|
|
625
625
|
input.focus();
|
|
626
626
|
simulateTab();
|
|
627
627
|
|
|
628
|
-
expect(elOutside).to.
|
|
628
|
+
expect(isActiveElement(elOutside)).to.be.true;
|
|
629
629
|
});
|
|
630
630
|
|
|
631
631
|
it('keeps focus within overlay with multiple overlays with all traps on true', async () => {
|
|
@@ -648,6 +648,30 @@ describe('OverlayController', () => {
|
|
|
648
648
|
expect(ctrl0.hasActiveTrapsKeyboardFocus).to.be.true;
|
|
649
649
|
expect(ctrl1.hasActiveTrapsKeyboardFocus).to.be.false;
|
|
650
650
|
});
|
|
651
|
+
|
|
652
|
+
it('warns when contentNode is a host for a shadowRoot', async () => {
|
|
653
|
+
const warnSpy = sinon.spy(console, 'warn');
|
|
654
|
+
|
|
655
|
+
const contentNode = /** @type {HTMLDivElement} */ (await fixture(html` <div></div> `));
|
|
656
|
+
contentNode.attachShadow({ mode: 'open' });
|
|
657
|
+
const shadowRootContentNode = /** @type {HTMLElement} */ (
|
|
658
|
+
await fixture(html` <div><input id="input1" /><input id="input2" /></div> `)
|
|
659
|
+
);
|
|
660
|
+
contentNode.shadowRoot?.appendChild(shadowRootContentNode);
|
|
661
|
+
|
|
662
|
+
const ctrl = new OverlayController({
|
|
663
|
+
...withGlobalTestConfig(),
|
|
664
|
+
trapsKeyboardFocus: true,
|
|
665
|
+
contentNode,
|
|
666
|
+
});
|
|
667
|
+
await ctrl.show();
|
|
668
|
+
|
|
669
|
+
// @ts-expect-error
|
|
670
|
+
expect(console.warn.args[0][0]).to.equal(
|
|
671
|
+
'[overlays]: For best accessibility (compatibility with Safari + VoiceOver), provide a contentNode that is not a host for a shadow root',
|
|
672
|
+
);
|
|
673
|
+
warnSpy.restore();
|
|
674
|
+
});
|
|
651
675
|
});
|
|
652
676
|
|
|
653
677
|
describe('hidesOnEsc', () => {
|
|
@@ -31,10 +31,11 @@ const fixture = /** @type {(arg: TemplateResult) => Promise<LionSelectRich>} */
|
|
|
31
31
|
describe('lion-select-rich', () => {
|
|
32
32
|
it('clicking the label should focus the invoker', async () => {
|
|
33
33
|
const el = await fixture(html` <lion-select-rich label="foo"> </lion-select-rich> `);
|
|
34
|
-
expect(document.
|
|
34
|
+
expect(isActiveElement(document.body)).to.be.true;
|
|
35
|
+
|
|
35
36
|
const { _labelNode, _invokerNode } = getSelectRichMembers(el);
|
|
36
37
|
_labelNode.click();
|
|
37
|
-
expect(
|
|
38
|
+
expect(isActiveElement(_invokerNode)).to.be.true;
|
|
38
39
|
});
|
|
39
40
|
|
|
40
41
|
it('has an attribute focused when focused', async () => {
|
|
@@ -276,14 +277,14 @@ describe('lion-select-rich', () => {
|
|
|
276
277
|
|
|
277
278
|
await _overlayCtrl.show();
|
|
278
279
|
await el.updateComplete;
|
|
279
|
-
expect(
|
|
280
|
-
expect(
|
|
280
|
+
expect(isActiveElement(_listboxNode)).to.be.true;
|
|
281
|
+
expect(isActiveElement(_invokerNode)).to.be.false;
|
|
281
282
|
|
|
282
283
|
el.opened = false;
|
|
283
284
|
await el.updateComplete;
|
|
284
285
|
await el.updateComplete; // safari takes a little longer
|
|
285
|
-
expect(
|
|
286
|
-
expect(
|
|
286
|
+
expect(isActiveElement(_listboxNode)).to.be.false;
|
|
287
|
+
expect(isActiveElement(_invokerNode)).to.be.true;
|
|
287
288
|
});
|
|
288
289
|
|
|
289
290
|
it('opens the listbox with checked option as active', async () => {
|
|
@@ -472,7 +473,7 @@ describe('lion-select-rich', () => {
|
|
|
472
473
|
<lion-select-rich .config=${{ trapsKeyboardFocus: true }}></lion-select-rich>
|
|
473
474
|
`);
|
|
474
475
|
const { _listboxNode } = getSelectRichMembers(el);
|
|
475
|
-
expect(
|
|
476
|
+
expect(isActiveElement(_listboxNode)).to.be.false;
|
|
476
477
|
|
|
477
478
|
el.opened = true;
|
|
478
479
|
await el.updateComplete;
|
|
@@ -481,7 +482,7 @@ describe('lion-select-rich', () => {
|
|
|
481
482
|
el.opened = false;
|
|
482
483
|
await el.updateComplete;
|
|
483
484
|
await el.updateComplete; // safari takes a little longer
|
|
484
|
-
expect(
|
|
485
|
+
expect(isActiveElement(_listboxNode)).to.be.false;
|
|
485
486
|
});
|
|
486
487
|
});
|
|
487
488
|
|
|
@@ -69,7 +69,7 @@ describe('lion-switch', () => {
|
|
|
69
69
|
const { _inputNode, _labelNode } = getSwitchMembers(el);
|
|
70
70
|
|
|
71
71
|
_labelNode.click();
|
|
72
|
-
expect(
|
|
72
|
+
expect(isActiveElement(_inputNode)).to.be.false;
|
|
73
73
|
});
|
|
74
74
|
|
|
75
75
|
it('should sync its "disabled" state to child button', async () => {
|
|
@@ -2,6 +2,8 @@ import { expect, fixture } from '@open-wc/testing';
|
|
|
2
2
|
import { html } from 'lit/static-html.js';
|
|
3
3
|
import sinon from 'sinon';
|
|
4
4
|
|
|
5
|
+
import { isActiveElement } from '../../core/test-helpers/isActiveElement.js';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* @typedef {import('../src/LionTabs.js').LionTabs} LionTabs
|
|
7
9
|
*/
|
|
@@ -397,9 +399,11 @@ describe('<lion-tabs>', () => {
|
|
|
397
399
|
`)
|
|
398
400
|
);
|
|
399
401
|
|
|
402
|
+
const secondTab = /** @type {HTMLElement} */ (
|
|
403
|
+
el.querySelector('[slot="tab"]:nth-of-type(2)')
|
|
404
|
+
);
|
|
400
405
|
el.selectedIndex = 1;
|
|
401
|
-
expect(
|
|
402
|
-
.false;
|
|
406
|
+
expect(isActiveElement(secondTab)).to.be.false;
|
|
403
407
|
});
|
|
404
408
|
|
|
405
409
|
it('does not focus a tab on firstUpdate', async () => {
|
|
@@ -414,7 +418,7 @@ describe('<lion-tabs>', () => {
|
|
|
414
418
|
`)
|
|
415
419
|
);
|
|
416
420
|
const tabs = Array.from(el.children).filter(child => child.slot === 'tab');
|
|
417
|
-
expect(tabs.some(tab => tab
|
|
421
|
+
expect(tabs.some(tab => isActiveElement(tab))).to.be.false;
|
|
418
422
|
});
|
|
419
423
|
|
|
420
424
|
it('focuses on a tab when setting with _setSelectedIndexWithFocus method', async () => {
|
|
@@ -429,9 +433,12 @@ describe('<lion-tabs>', () => {
|
|
|
429
433
|
`)
|
|
430
434
|
);
|
|
431
435
|
|
|
436
|
+
const secondTab = /** @type {HTMLElement} */ (
|
|
437
|
+
el.querySelector('[slot="tab"]:nth-of-type(2)')
|
|
438
|
+
);
|
|
432
439
|
// @ts-ignore : this el is LionTabs
|
|
433
440
|
el._setSelectedIndexWithFocus(1);
|
|
434
|
-
expect(
|
|
441
|
+
expect(isActiveElement(secondTab)).to.be.true;
|
|
435
442
|
});
|
|
436
443
|
});
|
|
437
444
|
|
|
@@ -448,7 +455,7 @@ describe('<lion-tabs>', () => {
|
|
|
448
455
|
);
|
|
449
456
|
const secondTab = /** @type {Element} */ (el.querySelector('[slot="tab"]:nth-of-type(2)'));
|
|
450
457
|
secondTab.dispatchEvent(new MouseEvent('click'));
|
|
451
|
-
expect(secondTab
|
|
458
|
+
expect(isActiveElement(secondTab)).to.be.true;
|
|
452
459
|
});
|
|
453
460
|
|
|
454
461
|
describe('Accessibility', () => {
|