@lion/ui 0.7.9 → 0.8.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/README.md +7 -7
- package/components/accordion/src/LionAccordion.js +1 -1
- package/components/accordion/test/lion-accordion.test.js +9 -4
- package/components/calendar/src/LionCalendar.js +3 -1
- package/components/combobox/test/lion-combobox.test.js +124 -120
- package/components/combobox/test/validators.test.js +2 -2
- package/components/combobox/test-helpers/combobox-helpers.js +8 -9
- package/components/core/src/browserDetection.js +9 -1
- package/components/form/src/LionForm.js +3 -12
- package/components/form/test/lion-form.test.js +88 -1
- package/components/form-core/src/registration/FormRegisteringMixin.js +1 -1
- package/components/form-core/test-suites/NativeTextFieldMixin.suite.js +9 -10
- package/components/form-core/types/registration/FormRegisteringMixinTypes.ts +1 -1
- package/components/listbox/test-suites/ListboxMixin.suite.js +2 -2
- package/components/localize/src/LocalizeManager.js +3 -28
- package/components/overlays/src/OverlayController.js +1 -1
- package/custom-elements.json +791 -2668
- package/dist-types/components/accordion/test/lion-accordion.test.d.ts.map +1 -1
- package/dist-types/components/calendar/src/LionCalendar.d.ts +0 -1
- package/dist-types/components/calendar/src/LionCalendar.d.ts.map +1 -1
- package/dist-types/components/combobox/test-helpers/combobox-helpers.d.ts +2 -2
- package/dist-types/components/combobox/test-helpers/combobox-helpers.d.ts.map +1 -1
- package/dist-types/components/form/src/LionForm.d.ts.map +1 -1
- package/dist-types/components/form/test/lion-form.test.d.ts.map +1 -1
- package/dist-types/components/form-core/test-suites/NativeTextFieldMixin.suite.d.ts.map +1 -1
- package/dist-types/components/form-core/types/registration/FormRegisteringMixinTypes.d.ts +1 -1
- package/dist-types/components/form-integrations/test/helpers/helpers.d.ts +3 -3
- package/dist-types/components/form-integrations/test/helpers/helpers.d.ts.map +1 -1
- package/dist-types/components/icon/src/LionIcon.d.ts +2 -2
- package/dist-types/components/icon/src/LionIcon.d.ts.map +1 -1
- package/dist-types/components/localize/src/LocalizeManager.d.ts +1 -19
- package/dist-types/components/localize/src/LocalizeManager.d.ts.map +1 -1
- package/dist-types/tsconfig.tsbuildinfo +1 -1
- package/docs/components/checkbox-group/api-table.md +2 -2
- package/docs/components/checkbox-group/overview.md +2 -2
- package/docs/components/collapsible/overview.md +1 -1
- package/docs/components/combobox/overview.md +1 -1
- package/docs/components/combobox/use-cases.md +3 -4
- package/docs/components/dialog/overview.md +1 -1
- package/docs/components/fieldset/overview.md +5 -5
- package/docs/components/form/overview.md +3 -3
- package/docs/components/icon/use-cases.md +1 -1
- package/docs/components/input/api-table.md +1 -1
- package/docs/components/input/overview.md +1 -1
- package/docs/components/input-amount/api-table.md +1 -1
- package/docs/components/input-amount/overview.md +3 -3
- package/docs/components/input-date/api-table.md +1 -1
- package/docs/components/input-date/overview.md +3 -3
- package/docs/components/input-date/use-cases.md +2 -3
- package/docs/components/input-datepicker/api-table.md +1 -1
- package/docs/components/input-datepicker/overview.md +5 -5
- package/docs/components/input-datepicker/use-cases.md +2 -3
- package/docs/components/input-email/api-table.md +1 -1
- package/docs/components/input-email/overview.md +2 -2
- package/docs/components/input-file/api-table.md +1 -1
- package/docs/components/input-file/overview.md +1 -1
- package/docs/components/input-iban/api-table.md +1 -1
- package/docs/components/input-iban/overview.md +2 -2
- package/docs/components/input-range/api-table.md +1 -1
- package/docs/components/input-range/overview.md +2 -2
- package/docs/components/input-stepper/api-table.md +1 -1
- package/docs/components/input-stepper/overview.md +1 -1
- package/docs/components/input-tel/api-table.md +1 -1
- 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 -1
- package/docs/components/input-tel-dropdown/overview.md +1 -1
- package/docs/components/listbox/api-table.md +1 -1
- package/docs/components/listbox/use-cases.md +1 -1
- package/docs/components/radio-group/api-table.md +1 -1
- package/docs/components/radio-group/overview.md +3 -3
- package/docs/components/select/api-table.md +1 -1
- package/docs/components/select/use-cases.md +1 -1
- package/docs/components/select-rich/use-cases.md +1 -1
- package/docs/components/switch/api-table.md +1 -1
- package/docs/components/tabs/examples.md +1 -1
- package/docs/components/textarea/api-table.md +1 -1
- package/docs/fundamentals/index.md +4 -4
- package/docs/fundamentals/node-tools/providence-analytics/LocalConfiguration.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/QueryResult.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/analyzer.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/dashboard.md +1 -1
- package/docs/fundamentals/node-tools/providence-analytics/overview.md +3 -3
- 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 -1
- 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/api-table.md +0 -3
- 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
|
@@ -63,12 +63,13 @@ describe('lion-combobox', () => {
|
|
|
63
63
|
const visibleOptions = () => options.filter(o => o.getAttribute('aria-hidden') !== 'true');
|
|
64
64
|
|
|
65
65
|
async function performChecks() {
|
|
66
|
-
mimicUserTyping(el, 'c');
|
|
66
|
+
await mimicUserTyping(el, 'c');
|
|
67
67
|
await el.updateComplete;
|
|
68
|
-
expect(visibleOptions().length).to.equal(4);
|
|
69
|
-
|
|
68
|
+
expect(visibleOptions().length).to.equal(4, `autocompleteMode is ${el.autocomplete}`);
|
|
69
|
+
// Remove [hard], [c]
|
|
70
|
+
await mimicUserTypingAdvanced(el, ['Backspace', 'Backspace']);
|
|
70
71
|
await el.updateComplete;
|
|
71
|
-
expect(visibleOptions().length).to.equal(0);
|
|
72
|
+
expect(visibleOptions().length).to.equal(0, `autocompleteMode is ${el.autocomplete}`);
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
el.autocomplete = 'none';
|
|
@@ -96,7 +97,7 @@ describe('lion-combobox', () => {
|
|
|
96
97
|
const options = el.formElements;
|
|
97
98
|
const visibleOptions = () => options.filter(o => o.style.display !== 'none');
|
|
98
99
|
|
|
99
|
-
mimicUserTyping(el, 'cha');
|
|
100
|
+
await mimicUserTyping(el, 'cha');
|
|
100
101
|
await el.updateComplete;
|
|
101
102
|
expect(visibleOptions().length).to.equal(1);
|
|
102
103
|
el.reset();
|
|
@@ -119,7 +120,7 @@ describe('lion-combobox', () => {
|
|
|
119
120
|
const options = el.formElements;
|
|
120
121
|
const visibleOptions = () => options.filter(o => o.getAttribute('aria-hidden') !== 'true');
|
|
121
122
|
|
|
122
|
-
mimicUserTyping(el, 'cha');
|
|
123
|
+
await mimicUserTyping(el, 'cha');
|
|
123
124
|
await el.updateComplete;
|
|
124
125
|
expect(visibleOptions().length).to.equal(1);
|
|
125
126
|
expect(el.opened).to.be.true;
|
|
@@ -144,7 +145,7 @@ describe('lion-combobox', () => {
|
|
|
144
145
|
const { _listboxNode } = getComboboxMembers(el);
|
|
145
146
|
|
|
146
147
|
async function open() {
|
|
147
|
-
mimicUserTyping(el, 'ch');
|
|
148
|
+
await mimicUserTyping(el, 'ch');
|
|
148
149
|
return el.updateComplete;
|
|
149
150
|
}
|
|
150
151
|
|
|
@@ -178,10 +179,10 @@ describe('lion-combobox', () => {
|
|
|
178
179
|
const visibleOptions = () => options.filter(o => o.getAttribute('aria-hidden') !== 'true');
|
|
179
180
|
|
|
180
181
|
async function performChecks() {
|
|
181
|
-
mimicUserTyping(el, 'c');
|
|
182
|
+
await mimicUserTyping(el, 'c');
|
|
182
183
|
await el.updateComplete;
|
|
183
184
|
expect(visibleOptions().length).to.equal(4);
|
|
184
|
-
mimicUserTyping(el, '');
|
|
185
|
+
await mimicUserTyping(el, '');
|
|
185
186
|
await el.updateComplete;
|
|
186
187
|
expect(visibleOptions().length).to.equal(options.length);
|
|
187
188
|
}
|
|
@@ -218,7 +219,7 @@ describe('lion-combobox', () => {
|
|
|
218
219
|
it('hides overlay on [Escape] after being opened', async () => {
|
|
219
220
|
const el = /** @type {LionCombobox} */ (
|
|
220
221
|
await fixture(html`
|
|
221
|
-
<lion-combobox name="foo" .showAllOnEmpty="${true}">
|
|
222
|
+
<lion-combobox name="foo" .showAllOnEmpty="${true}" opened>
|
|
222
223
|
<lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
|
|
223
224
|
<lion-option .choiceValue="${'Chard'}">Chard</lion-option>
|
|
224
225
|
<lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
|
|
@@ -226,12 +227,8 @@ describe('lion-combobox', () => {
|
|
|
226
227
|
</lion-combobox>
|
|
227
228
|
`)
|
|
228
229
|
);
|
|
229
|
-
const {
|
|
230
|
+
const { _inputNode } = getComboboxMembers(el);
|
|
230
231
|
|
|
231
|
-
expect(el.opened).to.be.false;
|
|
232
|
-
_comboboxNode.dispatchEvent(new Event('click', { bubbles: true, composed: true }));
|
|
233
|
-
await el.updateComplete;
|
|
234
|
-
expect(el.opened).to.be.true;
|
|
235
232
|
_inputNode.dispatchEvent(new KeyboardEvent('keyup', { key: 'Escape' }));
|
|
236
233
|
await el.updateComplete;
|
|
237
234
|
expect(el.opened).to.be.false;
|
|
@@ -252,7 +249,7 @@ describe('lion-combobox', () => {
|
|
|
252
249
|
const { _listboxNode, _inputNode } = getComboboxMembers(el);
|
|
253
250
|
|
|
254
251
|
async function open() {
|
|
255
|
-
mimicUserTyping(el, 'ch');
|
|
252
|
+
await mimicUserTyping(el, 'ch');
|
|
256
253
|
return el.updateComplete;
|
|
257
254
|
}
|
|
258
255
|
|
|
@@ -326,7 +323,7 @@ describe('lion-combobox', () => {
|
|
|
326
323
|
</lion-combobox>
|
|
327
324
|
`)
|
|
328
325
|
);
|
|
329
|
-
mimicUserTyping(el, '30');
|
|
326
|
+
await mimicUserTyping(el, '30');
|
|
330
327
|
await el.updateComplete;
|
|
331
328
|
expect(el.hasFeedbackFor).to.include('error');
|
|
332
329
|
expect(el.validationStates).to.have.property('error');
|
|
@@ -512,7 +509,7 @@ describe('lion-combobox', () => {
|
|
|
512
509
|
`)
|
|
513
510
|
);
|
|
514
511
|
const options = el.formElements;
|
|
515
|
-
mimicUserTyping(el, 'a');
|
|
512
|
+
await mimicUserTyping(el, 'a');
|
|
516
513
|
await el.updateComplete;
|
|
517
514
|
|
|
518
515
|
const visibleOptions = () => options.filter(o => o.style.display !== 'none');
|
|
@@ -575,15 +572,15 @@ describe('lion-combobox', () => {
|
|
|
575
572
|
await el.updateComplete;
|
|
576
573
|
|
|
577
574
|
// FIXME: fix properly for Webkit
|
|
578
|
-
// expect(_inputNode.value).to.equal('Aha', `
|
|
579
|
-
expect(el.checkedIndex).to.equal(0, `
|
|
575
|
+
// expect(_inputNode.value).to.equal('Aha', `autocompleteMode is ${autocompleteMode}`);
|
|
576
|
+
expect(el.checkedIndex).to.equal(0, `autocompleteMode is ${autocompleteMode}`);
|
|
580
577
|
|
|
581
|
-
mimicUserTyping(el, 'Ah');
|
|
578
|
+
await mimicUserTyping(el, 'Ah');
|
|
582
579
|
await el.updateComplete;
|
|
583
|
-
expect(_inputNode.value).to.equal('Ah', `
|
|
580
|
+
expect(_inputNode.value).to.equal('Ah', `autocompleteMode is ${autocompleteMode}`);
|
|
584
581
|
|
|
585
582
|
await el.updateComplete;
|
|
586
|
-
expect(el.checkedIndex).to.equal(-1, `
|
|
583
|
+
expect(el.checkedIndex).to.equal(-1, `autocompleteMode is ${autocompleteMode}`);
|
|
587
584
|
}
|
|
588
585
|
|
|
589
586
|
el.autocomplete = 'none';
|
|
@@ -631,7 +628,7 @@ describe('lion-combobox', () => {
|
|
|
631
628
|
await el.updateComplete;
|
|
632
629
|
expect(el.modelValue).to.eql([]);
|
|
633
630
|
|
|
634
|
-
mimicUserTyping(el, ' ');
|
|
631
|
+
await mimicUserTyping(el, ' ');
|
|
635
632
|
await el.updateComplete;
|
|
636
633
|
mimicKeyPress(_inputNode, 'Enter');
|
|
637
634
|
await el.updateComplete;
|
|
@@ -653,7 +650,7 @@ describe('lion-combobox', () => {
|
|
|
653
650
|
const { _inputNode } = getComboboxMembers(el);
|
|
654
651
|
expect(el.checkedIndex).to.equal(0);
|
|
655
652
|
|
|
656
|
-
mimicUserTyping(el, 'Foo');
|
|
653
|
+
await mimicUserTyping(el, 'Foo');
|
|
657
654
|
_inputNode.dispatchEvent(new Event('input'));
|
|
658
655
|
await el.updateComplete;
|
|
659
656
|
|
|
@@ -676,7 +673,7 @@ describe('lion-combobox', () => {
|
|
|
676
673
|
el.requireOptionMatch = false;
|
|
677
674
|
const { _inputNode } = getComboboxMembers(el);
|
|
678
675
|
|
|
679
|
-
mimicUserTyping(el, 'Art');
|
|
676
|
+
await mimicUserTyping(el, 'Art');
|
|
680
677
|
await el.updateComplete;
|
|
681
678
|
|
|
682
679
|
await mimicUserTypingAdvanced(el, ['Delete']);
|
|
@@ -768,7 +765,7 @@ describe('lion-combobox', () => {
|
|
|
768
765
|
expect(el.modelValue).to.eql(['Chard']);
|
|
769
766
|
expect(el.checkedIndex).to.eql([1]);
|
|
770
767
|
|
|
771
|
-
mimicUserTyping(el, 'Foo');
|
|
768
|
+
await mimicUserTyping(el, 'Foo');
|
|
772
769
|
await el.updateComplete;
|
|
773
770
|
mimicKeyPress(_inputNode, 'Enter');
|
|
774
771
|
await el.updateComplete;
|
|
@@ -776,7 +773,7 @@ describe('lion-combobox', () => {
|
|
|
776
773
|
expect(el.modelValue).to.eql(['Chard', 'Foo']);
|
|
777
774
|
expect(el.checkedIndex).to.eql([1]);
|
|
778
775
|
|
|
779
|
-
mimicUserTyping(el, 'Bar');
|
|
776
|
+
await mimicUserTyping(el, 'Bar');
|
|
780
777
|
await el.updateComplete;
|
|
781
778
|
mimicKeyPress(_inputNode, 'Enter');
|
|
782
779
|
await el.updateComplete;
|
|
@@ -804,7 +801,7 @@ describe('lion-combobox', () => {
|
|
|
804
801
|
|
|
805
802
|
const { _inputNode } = getComboboxMembers(el);
|
|
806
803
|
|
|
807
|
-
mimicUserTyping(el, 'Foo');
|
|
804
|
+
await mimicUserTyping(el, 'Foo');
|
|
808
805
|
await el.updateComplete;
|
|
809
806
|
mimicKeyPress(_inputNode, 'Enter');
|
|
810
807
|
await el.updateComplete;
|
|
@@ -812,7 +809,7 @@ describe('lion-combobox', () => {
|
|
|
812
809
|
expect(el.modelValue).to.eql(['Foo']);
|
|
813
810
|
expect(el.checkedIndex).to.eql([]);
|
|
814
811
|
|
|
815
|
-
mimicUserTyping(el, 'Bar');
|
|
812
|
+
await mimicUserTyping(el, 'Bar');
|
|
816
813
|
await el.updateComplete;
|
|
817
814
|
mimicKeyPress(_inputNode, 'Enter');
|
|
818
815
|
await el.updateComplete;
|
|
@@ -842,7 +839,7 @@ describe('lion-combobox', () => {
|
|
|
842
839
|
|
|
843
840
|
const { _inputNode } = getComboboxMembers(el);
|
|
844
841
|
|
|
845
|
-
mimicUserTyping(el, 'Artist');
|
|
842
|
+
await mimicUserTyping(el, 'Artist');
|
|
846
843
|
await el.updateComplete;
|
|
847
844
|
mimicKeyPress(_inputNode, 'Enter');
|
|
848
845
|
await el.updateComplete;
|
|
@@ -870,7 +867,7 @@ describe('lion-combobox', () => {
|
|
|
870
867
|
await el.updateComplete;
|
|
871
868
|
|
|
872
869
|
const { _inputNode } = getComboboxMembers(el);
|
|
873
|
-
mimicUserTyping(el, 'Art');
|
|
870
|
+
await mimicUserTyping(el, 'Art');
|
|
874
871
|
await el.updateComplete;
|
|
875
872
|
await mimicUserTypingAdvanced(el, ['Backspace']);
|
|
876
873
|
await el.updateComplete;
|
|
@@ -902,7 +899,7 @@ describe('lion-combobox', () => {
|
|
|
902
899
|
const { _inputNode } = getComboboxMembers(el);
|
|
903
900
|
el.modelValue = [];
|
|
904
901
|
|
|
905
|
-
mimicUserTyping(el, 'Art');
|
|
902
|
+
await mimicUserTyping(el, 'Art');
|
|
906
903
|
await el.updateComplete;
|
|
907
904
|
await mimicUserTypingAdvanced(el, ['Delete']);
|
|
908
905
|
await el.updateComplete;
|
|
@@ -981,7 +978,7 @@ describe('lion-combobox', () => {
|
|
|
981
978
|
expect(el.opened).to.equal(false);
|
|
982
979
|
|
|
983
980
|
// step [2]
|
|
984
|
-
mimicUserTyping(el, 'c');
|
|
981
|
+
await mimicUserTyping(el, 'c');
|
|
985
982
|
await el.updateComplete;
|
|
986
983
|
expect(el.opened).to.equal(true);
|
|
987
984
|
|
|
@@ -993,7 +990,7 @@ describe('lion-combobox', () => {
|
|
|
993
990
|
|
|
994
991
|
// step [4]
|
|
995
992
|
await el.updateComplete;
|
|
996
|
-
mimicUserTyping(el, 'c');
|
|
993
|
+
await mimicUserTyping(el, 'c');
|
|
997
994
|
await el.updateComplete;
|
|
998
995
|
expect(el.opened).to.equal(true);
|
|
999
996
|
});
|
|
@@ -1012,7 +1009,7 @@ describe('lion-combobox', () => {
|
|
|
1012
1009
|
|
|
1013
1010
|
const { _inputNode } = getComboboxMembers(el);
|
|
1014
1011
|
|
|
1015
|
-
mimicUserTyping(el, 'art');
|
|
1012
|
+
await mimicUserTyping(el, 'art');
|
|
1016
1013
|
await el.updateComplete;
|
|
1017
1014
|
expect(el.opened).to.equal(true);
|
|
1018
1015
|
expect(_inputNode.value).to.equal('Artichoke');
|
|
@@ -1036,7 +1033,7 @@ describe('lion-combobox', () => {
|
|
|
1036
1033
|
|
|
1037
1034
|
const { _inputNode } = getComboboxMembers(el);
|
|
1038
1035
|
|
|
1039
|
-
mimicUserTyping(el, 'art');
|
|
1036
|
+
await mimicUserTyping(el, 'art');
|
|
1040
1037
|
await el.updateComplete;
|
|
1041
1038
|
expect(el.opened).to.equal(true);
|
|
1042
1039
|
expect(_inputNode.value).to.equal('Artichoke');
|
|
@@ -1062,7 +1059,7 @@ describe('lion-combobox', () => {
|
|
|
1062
1059
|
|
|
1063
1060
|
const { _inputNode } = getComboboxMembers(el);
|
|
1064
1061
|
|
|
1065
|
-
mimicUserTyping(el, 'art');
|
|
1062
|
+
await mimicUserTyping(el, 'art');
|
|
1066
1063
|
await el.updateComplete;
|
|
1067
1064
|
expect(el.opened).to.equal(true);
|
|
1068
1065
|
expect(_inputNode.value).to.equal('Artichoke');
|
|
@@ -1088,7 +1085,7 @@ describe('lion-combobox', () => {
|
|
|
1088
1085
|
|
|
1089
1086
|
const { _inputNode } = getComboboxMembers(el);
|
|
1090
1087
|
|
|
1091
|
-
mimicUserTyping(el, 'art');
|
|
1088
|
+
await mimicUserTyping(el, 'art');
|
|
1092
1089
|
await el.updateComplete;
|
|
1093
1090
|
expect(el.opened).to.equal(true);
|
|
1094
1091
|
expect(_inputNode.value).to.equal('Artichoke');
|
|
@@ -1114,13 +1111,14 @@ describe('lion-combobox', () => {
|
|
|
1114
1111
|
|
|
1115
1112
|
const { _inputNode } = getComboboxMembers(el);
|
|
1116
1113
|
|
|
1117
|
-
mimicUserTyping(el, 'art');
|
|
1114
|
+
await mimicUserTyping(el, 'art');
|
|
1118
1115
|
await el.updateComplete;
|
|
1119
1116
|
expect(el.opened).to.equal(true);
|
|
1120
1117
|
expect(_inputNode.value).to.equal('Artichoke');
|
|
1121
1118
|
expect(el.checkedIndex).to.equal(0);
|
|
1122
1119
|
|
|
1123
|
-
mimicUserTyping(el, '');
|
|
1120
|
+
// await mimicUserTyping(el, '');
|
|
1121
|
+
await sendKeys({ press: 'Backspace' });
|
|
1124
1122
|
await el.updateComplete;
|
|
1125
1123
|
el.opened = false;
|
|
1126
1124
|
await el.updateComplete;
|
|
@@ -1138,12 +1136,17 @@ describe('lion-combobox', () => {
|
|
|
1138
1136
|
</lion-combobox>
|
|
1139
1137
|
`)
|
|
1140
1138
|
);
|
|
1141
|
-
// @ts-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1139
|
+
// @ts-expect-error [allow-protected] in test
|
|
1140
|
+
const overlayCfg = el._defineOverlayConfig();
|
|
1141
|
+
|
|
1142
|
+
const equalsOrContainsInput = (/** @type {HTMLInputElement|HTMLDivElement} */ invokerNode) =>
|
|
1143
|
+
// @ts-expect-error [allow-protected] in test
|
|
1144
|
+
invokerNode === el._inputNode || invokerNode.contains(el._inputNode);
|
|
1145
|
+
|
|
1146
|
+
expect(overlayCfg.elementToFocusAfterHide).to.equal(undefined);
|
|
1147
|
+
// @ts-expect-error
|
|
1148
|
+
expect(equalsOrContainsInput(overlayCfg.invokerNode)).to.be.true;
|
|
1149
|
+
expect(overlayCfg.visibilityTriggerFunction).to.equal(undefined);
|
|
1147
1150
|
});
|
|
1148
1151
|
|
|
1149
1152
|
// NB: If this becomes a suite, move to separate file
|
|
@@ -1169,7 +1172,7 @@ describe('lion-combobox', () => {
|
|
|
1169
1172
|
`)
|
|
1170
1173
|
);
|
|
1171
1174
|
|
|
1172
|
-
mimicUserTyping(el, 'aaa');
|
|
1175
|
+
await mimicUserTyping(el, 'aaa');
|
|
1173
1176
|
expect(el.opened).to.be.false;
|
|
1174
1177
|
});
|
|
1175
1178
|
|
|
@@ -1194,7 +1197,7 @@ describe('lion-combobox', () => {
|
|
|
1194
1197
|
`)
|
|
1195
1198
|
);
|
|
1196
1199
|
|
|
1197
|
-
mimicUserTyping(el, 'aaaa');
|
|
1200
|
+
await mimicUserTyping(el, 'aaaa');
|
|
1198
1201
|
expect(el.opened).to.be.true;
|
|
1199
1202
|
});
|
|
1200
1203
|
|
|
@@ -1219,10 +1222,10 @@ describe('lion-combobox', () => {
|
|
|
1219
1222
|
`)
|
|
1220
1223
|
);
|
|
1221
1224
|
|
|
1222
|
-
mimicUserTyping(el, 'aaaa');
|
|
1225
|
+
await mimicUserTyping(el, 'aaaa');
|
|
1223
1226
|
expect(el.opened).to.be.true;
|
|
1224
1227
|
|
|
1225
|
-
mimicUserTyping(el, 'aaa');
|
|
1228
|
+
await mimicUserTyping(el, 'aaa');
|
|
1226
1229
|
await el.updateComplete;
|
|
1227
1230
|
expect(el.opened).to.be.false;
|
|
1228
1231
|
});
|
|
@@ -1243,7 +1246,7 @@ describe('lion-combobox', () => {
|
|
|
1243
1246
|
const options = el.formElements;
|
|
1244
1247
|
expect(el.opened).to.equal(false);
|
|
1245
1248
|
|
|
1246
|
-
mimicUserTyping(el, 'art');
|
|
1249
|
+
await mimicUserTyping(el, 'art');
|
|
1247
1250
|
await el.updateComplete;
|
|
1248
1251
|
expect(el.opened).to.equal(true);
|
|
1249
1252
|
|
|
@@ -1284,7 +1287,7 @@ describe('lion-combobox', () => {
|
|
|
1284
1287
|
const options = el.formElements;
|
|
1285
1288
|
expect(el.opened).to.equal(false);
|
|
1286
1289
|
|
|
1287
|
-
mimicUserTyping(el, 'art');
|
|
1290
|
+
await mimicUserTyping(el, 'art');
|
|
1288
1291
|
expect(el.opened).to.equal(true);
|
|
1289
1292
|
await el.updateComplete;
|
|
1290
1293
|
|
|
@@ -1531,7 +1534,7 @@ describe('lion-combobox', () => {
|
|
|
1531
1534
|
</lion-combobox>
|
|
1532
1535
|
`)
|
|
1533
1536
|
);
|
|
1534
|
-
mimicUserTyping(el, 'ch');
|
|
1537
|
+
await mimicUserTyping(el, 'ch');
|
|
1535
1538
|
await el.updateComplete;
|
|
1536
1539
|
expect(getFilteredOptionValues(el)).to.eql(['Artichoke', 'Chard', 'Chicory']);
|
|
1537
1540
|
});
|
|
@@ -1547,7 +1550,7 @@ describe('lion-combobox', () => {
|
|
|
1547
1550
|
</lion-combobox>
|
|
1548
1551
|
`)
|
|
1549
1552
|
);
|
|
1550
|
-
mimicUserTyping(el, 'ch');
|
|
1553
|
+
await mimicUserTyping(el, 'ch');
|
|
1551
1554
|
await el.updateComplete;
|
|
1552
1555
|
const { _inputNode } = getComboboxMembers(el);
|
|
1553
1556
|
|
|
@@ -1556,7 +1559,7 @@ describe('lion-combobox', () => {
|
|
|
1556
1559
|
expect(_inputNode.selectionEnd).to.equal(_inputNode.value.length);
|
|
1557
1560
|
|
|
1558
1561
|
// We don't autocomplete when characters are removed
|
|
1559
|
-
mimicUserTyping(el, 'c'); // The user pressed backspace (number of chars decreased)
|
|
1562
|
+
await mimicUserTyping(el, 'c'); // The user pressed backspace (number of chars decreased)
|
|
1560
1563
|
expect(_inputNode.value).to.equal('c');
|
|
1561
1564
|
expect(_inputNode.selectionStart).to.equal(_inputNode.value.length);
|
|
1562
1565
|
});
|
|
@@ -1574,7 +1577,7 @@ describe('lion-combobox', () => {
|
|
|
1574
1577
|
);
|
|
1575
1578
|
const { _inputNode } = getComboboxMembers(el);
|
|
1576
1579
|
|
|
1577
|
-
mimicUserTyping(el, 'ch');
|
|
1580
|
+
await mimicUserTyping(el, 'ch');
|
|
1578
1581
|
await el.updateComplete;
|
|
1579
1582
|
expect(getFilteredOptionValues(el)).to.eql(['Artichoke', 'Chard', 'Chicory']);
|
|
1580
1583
|
expect(_inputNode.value).to.equal('ch');
|
|
@@ -1591,7 +1594,7 @@ describe('lion-combobox', () => {
|
|
|
1591
1594
|
</lion-combobox>
|
|
1592
1595
|
`)
|
|
1593
1596
|
);
|
|
1594
|
-
mimicUserTyping(el, 'ch');
|
|
1597
|
+
await mimicUserTyping(el, 'ch');
|
|
1595
1598
|
await el.updateComplete;
|
|
1596
1599
|
expect(getFilteredOptionValues(el)).to.eql([
|
|
1597
1600
|
'Artichoke',
|
|
@@ -1653,7 +1656,7 @@ describe('lion-combobox', () => {
|
|
|
1653
1656
|
</lion-combobox>
|
|
1654
1657
|
`)
|
|
1655
1658
|
);
|
|
1656
|
-
mimicUserTyping(el, 'ch');
|
|
1659
|
+
await mimicUserTyping(el, 'ch');
|
|
1657
1660
|
await el.updateComplete;
|
|
1658
1661
|
expect(getFilteredOptionValues(el)).to.eql([
|
|
1659
1662
|
'Artichoke',
|
|
@@ -1675,11 +1678,11 @@ describe('lion-combobox', () => {
|
|
|
1675
1678
|
`)
|
|
1676
1679
|
);
|
|
1677
1680
|
|
|
1678
|
-
mimicUserTyping(el, 'ch');
|
|
1681
|
+
await mimicUserTyping(el, 'ch');
|
|
1679
1682
|
await el.updateComplete;
|
|
1680
1683
|
expect(el.checkedIndex).to.equal(1);
|
|
1681
1684
|
|
|
1682
|
-
mimicUserTyping(el, 'cho');
|
|
1685
|
+
await mimicUserTyping(el, 'cho');
|
|
1683
1686
|
await el.updateComplete;
|
|
1684
1687
|
expect(el.checkedIndex).to.equal(-1);
|
|
1685
1688
|
|
|
@@ -1695,12 +1698,12 @@ describe('lion-combobox', () => {
|
|
|
1695
1698
|
`)
|
|
1696
1699
|
);
|
|
1697
1700
|
|
|
1698
|
-
mimicUserTyping(el2, 'ch');
|
|
1701
|
+
await mimicUserTyping(el2, 'ch');
|
|
1699
1702
|
await el2.updateComplete;
|
|
1700
1703
|
expect(el2.checkedIndex).to.equal(1);
|
|
1701
1704
|
|
|
1702
1705
|
// Also works when 'diminishing amount of chars'
|
|
1703
|
-
mimicUserTyping(el2, 'x');
|
|
1706
|
+
await mimicUserTyping(el2, 'x');
|
|
1704
1707
|
await el2.updateComplete;
|
|
1705
1708
|
expect(el2.checkedIndex).to.equal(-1);
|
|
1706
1709
|
});
|
|
@@ -1718,11 +1721,11 @@ describe('lion-combobox', () => {
|
|
|
1718
1721
|
);
|
|
1719
1722
|
|
|
1720
1723
|
/** Goes from 2nd option Chard to 3rd option Chicory */
|
|
1721
|
-
mimicUserTyping(el, 'ch');
|
|
1724
|
+
await mimicUserTyping(el, 'ch');
|
|
1722
1725
|
await el.updateComplete;
|
|
1723
1726
|
expect(el.checkedIndex).to.equal(1);
|
|
1724
1727
|
|
|
1725
|
-
mimicUserTyping(el, 'chi');
|
|
1728
|
+
await mimicUserTyping(el, 'chi');
|
|
1726
1729
|
await el.updateComplete;
|
|
1727
1730
|
expect(el.checkedIndex).to.equal(2);
|
|
1728
1731
|
|
|
@@ -1737,14 +1740,14 @@ describe('lion-combobox', () => {
|
|
|
1737
1740
|
`)
|
|
1738
1741
|
);
|
|
1739
1742
|
|
|
1740
|
-
mimicUserTyping(el2, 'ch');
|
|
1743
|
+
await mimicUserTyping(el2, 'ch');
|
|
1741
1744
|
await el2.updateComplete;
|
|
1742
1745
|
expect(el2.checkedIndex).to.equal(1);
|
|
1743
1746
|
|
|
1744
1747
|
// match-mode all ensures the user sees Artichoke option, but it's not
|
|
1745
1748
|
// auto-completed or auto-selected, because it doesn't start with "cho"
|
|
1746
1749
|
// See next test for more clarification
|
|
1747
|
-
mimicUserTyping(el2, 'cho');
|
|
1750
|
+
await mimicUserTyping(el2, 'cho');
|
|
1748
1751
|
await el2.updateComplete;
|
|
1749
1752
|
expect(el2.checkedIndex).to.equal(-1);
|
|
1750
1753
|
expect(getFilteredOptionValues(el2)).to.eql(['Artichoke']);
|
|
@@ -1763,7 +1766,7 @@ describe('lion-combobox', () => {
|
|
|
1763
1766
|
);
|
|
1764
1767
|
|
|
1765
1768
|
// first match is Char'd', but better match is 'D'aikon
|
|
1766
|
-
mimicUserTyping(el, 'd');
|
|
1769
|
+
await mimicUserTyping(el, 'd');
|
|
1767
1770
|
await el.updateComplete;
|
|
1768
1771
|
expect(el.checkedIndex).to.equal(3);
|
|
1769
1772
|
expect(getFilteredOptionValues(el)).to.eql(['Chard', 'Daikon']);
|
|
@@ -1782,7 +1785,7 @@ describe('lion-combobox', () => {
|
|
|
1782
1785
|
);
|
|
1783
1786
|
const { _inputNode } = getComboboxMembers(el);
|
|
1784
1787
|
|
|
1785
|
-
mimicUserTyping(el, 'ch');
|
|
1788
|
+
await mimicUserTyping(el, 'ch');
|
|
1786
1789
|
await el.updateComplete;
|
|
1787
1790
|
expect(_inputNode.value).to.equal('Chard');
|
|
1788
1791
|
expect(_inputNode.selectionStart).to.equal('ch'.length);
|
|
@@ -1794,10 +1797,10 @@ describe('lion-combobox', () => {
|
|
|
1794
1797
|
expect(_inputNode.selectionStart).to.equal('chic'.length);
|
|
1795
1798
|
expect(_inputNode.selectionEnd).to.equal('Chicory'.length);
|
|
1796
1799
|
|
|
1797
|
-
// Diminishing chars, but
|
|
1798
|
-
|
|
1800
|
+
// Diminishing chars, but autocompletion
|
|
1801
|
+
await mimicUserTypingAdvanced(el, ['Backspace', 'Backspace', 'Backspace']); // Ch
|
|
1799
1802
|
await el.updateComplete;
|
|
1800
|
-
expect(_inputNode.value).to.equal('
|
|
1803
|
+
expect(_inputNode.value).to.equal('Ch');
|
|
1801
1804
|
expect(_inputNode.selectionStart).to.equal('ch'.length);
|
|
1802
1805
|
expect(_inputNode.selectionEnd).to.equal('ch'.length);
|
|
1803
1806
|
});
|
|
@@ -1903,7 +1906,7 @@ describe('lion-combobox', () => {
|
|
|
1903
1906
|
`)
|
|
1904
1907
|
);
|
|
1905
1908
|
|
|
1906
|
-
mimicUserTyping(el, 'ch'); // ch
|
|
1909
|
+
await mimicUserTyping(el, 'ch'); // ch
|
|
1907
1910
|
await el.updateComplete; // Ch[ard]
|
|
1908
1911
|
expect(el.activeIndex).to.equal(1);
|
|
1909
1912
|
expect(el.checkedIndex).to.equal(1);
|
|
@@ -1931,7 +1934,7 @@ describe('lion-combobox', () => {
|
|
|
1931
1934
|
`)
|
|
1932
1935
|
);
|
|
1933
1936
|
|
|
1934
|
-
mimicUserTyping(el, 'ch');
|
|
1937
|
+
await mimicUserTyping(el, 'ch');
|
|
1935
1938
|
await el.updateComplete;
|
|
1936
1939
|
expect(el.activeIndex).to.equal(1);
|
|
1937
1940
|
expect(el.checkedIndex).to.equal(1);
|
|
@@ -1941,8 +1944,8 @@ describe('lion-combobox', () => {
|
|
|
1941
1944
|
expect(el.activeIndex).to.equal(2);
|
|
1942
1945
|
expect(el.checkedIndex).to.equal(2);
|
|
1943
1946
|
|
|
1944
|
-
// Diminishing chars, but
|
|
1945
|
-
|
|
1947
|
+
// Diminishing chars, but autocompletion
|
|
1948
|
+
await mimicUserTypingAdvanced(el, ['Backspace', 'Backspace', 'Backspace', 'Backspace', 'a']); // a
|
|
1946
1949
|
await el.updateComplete;
|
|
1947
1950
|
expect(el.activeIndex).to.equal(0);
|
|
1948
1951
|
expect(el.checkedIndex).to.equal(0);
|
|
@@ -1962,7 +1965,7 @@ describe('lion-combobox', () => {
|
|
|
1962
1965
|
|
|
1963
1966
|
const { _inputNode } = getComboboxMembers(el);
|
|
1964
1967
|
|
|
1965
|
-
mimicUserTyping(el, 'char');
|
|
1968
|
+
await mimicUserTyping(el, 'char');
|
|
1966
1969
|
expect(_inputNode.value).to.equal('char');
|
|
1967
1970
|
await el.updateComplete; // Char
|
|
1968
1971
|
|
|
@@ -1989,7 +1992,7 @@ describe('lion-combobox', () => {
|
|
|
1989
1992
|
);
|
|
1990
1993
|
const { _inputNode } = getComboboxMembers(el);
|
|
1991
1994
|
|
|
1992
|
-
mimicUserTyping(el, 'ch');
|
|
1995
|
+
await mimicUserTyping(el, 'ch');
|
|
1993
1996
|
await el.updateComplete;
|
|
1994
1997
|
expect(_inputNode.value).to.equal('Chard');
|
|
1995
1998
|
expect(_inputNode.selectionStart).to.equal('Ch'.length);
|
|
@@ -2066,9 +2069,10 @@ describe('lion-combobox', () => {
|
|
|
2066
2069
|
// Arrange
|
|
2067
2070
|
const el = /** @type {MyEl} */ (await fixture(html`<${wrappingTag}></${wrappingTag}>`));
|
|
2068
2071
|
await el.combobox.registrationComplete;
|
|
2072
|
+
const { _inputNode } = getComboboxMembers(el.combobox);
|
|
2069
2073
|
|
|
2070
2074
|
// Act (start typing)
|
|
2071
|
-
|
|
2075
|
+
await mimicUserTypingAdvanced(el.combobox, ['l']);
|
|
2072
2076
|
// simulate fetching data from server
|
|
2073
2077
|
el.clearOptions();
|
|
2074
2078
|
await el.updateComplete;
|
|
@@ -2078,14 +2082,13 @@ describe('lion-combobox', () => {
|
|
|
2078
2082
|
await el.updateComplete;
|
|
2079
2083
|
|
|
2080
2084
|
// Assert
|
|
2081
|
-
const { _inputNode } = getComboboxMembers(el.combobox);
|
|
2082
2085
|
expect(_inputNode.value).to.equal('lorem');
|
|
2083
2086
|
expect(_inputNode.selectionStart).to.equal(1);
|
|
2084
2087
|
expect(_inputNode.selectionEnd).to.equal(_inputNode.value.length);
|
|
2085
2088
|
expect(getFilteredOptionValues(el.combobox)).to.eql(['lorem', 'dolor']);
|
|
2086
2089
|
|
|
2087
2090
|
// Act (continue typing)
|
|
2088
|
-
|
|
2091
|
+
await mimicUserTypingAdvanced(el.combobox, ['o']);
|
|
2089
2092
|
// simulate fetching data from server
|
|
2090
2093
|
el.clearOptions();
|
|
2091
2094
|
await el.updateComplete;
|
|
@@ -2101,7 +2104,7 @@ describe('lion-combobox', () => {
|
|
|
2101
2104
|
expect(getFilteredOptionValues(el.combobox)).to.eql(['lorem', 'dolor']);
|
|
2102
2105
|
|
|
2103
2106
|
// We don't autocomplete when characters are removed
|
|
2104
|
-
|
|
2107
|
+
await mimicUserTypingAdvanced(el.combobox, ['Backspace', 'Backspace']);
|
|
2105
2108
|
expect(_inputNode.value).to.equal('l');
|
|
2106
2109
|
expect(_inputNode.selectionStart).to.equal(_inputNode.value.length);
|
|
2107
2110
|
});
|
|
@@ -2148,7 +2151,7 @@ describe('lion-combobox', () => {
|
|
|
2148
2151
|
);
|
|
2149
2152
|
const options = el.formElements;
|
|
2150
2153
|
|
|
2151
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'c');
|
|
2154
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'c');
|
|
2152
2155
|
|
|
2153
2156
|
await el.updateComplete;
|
|
2154
2157
|
expect(options[0]).lightDom.to.equal(`<span aria-label="Artichoke">Arti<b>c</b>hoke</span>`);
|
|
@@ -2158,7 +2161,7 @@ describe('lion-combobox', () => {
|
|
|
2158
2161
|
`<span aria-label="Victoria Plum">Vi<b>c</b>toria Plum</span>`,
|
|
2159
2162
|
);
|
|
2160
2163
|
|
|
2161
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2164
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2162
2165
|
|
|
2163
2166
|
await el.updateComplete;
|
|
2164
2167
|
expect(options[0]).lightDom.to.equal(`<span aria-label="Artichoke">Arti<b>ch</b>oke</span>`);
|
|
@@ -2166,7 +2169,7 @@ describe('lion-combobox', () => {
|
|
|
2166
2169
|
expect(options[2]).lightDom.to.equal(`<span aria-label="Chicory"><b>Ch</b>icory</span>`);
|
|
2167
2170
|
expect(options[3]).lightDom.to.equal(`Victoria Plum`);
|
|
2168
2171
|
|
|
2169
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'D');
|
|
2172
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'D');
|
|
2170
2173
|
|
|
2171
2174
|
await el.updateComplete;
|
|
2172
2175
|
expect(options[0]).lightDom.to.equal(`Artichoke`);
|
|
@@ -2200,7 +2203,7 @@ describe('lion-combobox', () => {
|
|
|
2200
2203
|
);
|
|
2201
2204
|
const options = el.formElements;
|
|
2202
2205
|
|
|
2203
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2206
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2204
2207
|
|
|
2205
2208
|
await el.updateComplete;
|
|
2206
2209
|
expect(options[0]).lightDom.to.equal(
|
|
@@ -2230,7 +2233,7 @@ describe('lion-combobox', () => {
|
|
|
2230
2233
|
);
|
|
2231
2234
|
const options = el.formElements;
|
|
2232
2235
|
|
|
2233
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'c');
|
|
2236
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'c');
|
|
2234
2237
|
|
|
2235
2238
|
await el.updateComplete;
|
|
2236
2239
|
expect(options[0]).lightDom.to.equal(`<span aria-label="Artichoke">Arti<b>c</b>hoke</span>`);
|
|
@@ -2569,12 +2572,13 @@ describe('lion-combobox', () => {
|
|
|
2569
2572
|
// expect(_inputNode.value).to.equal('Aha', autocompleteMode);
|
|
2570
2573
|
expect(el.checkedIndex).to.equal(0, autocompleteMode);
|
|
2571
2574
|
|
|
2572
|
-
|
|
2575
|
+
await mimicUserTypingAdvanced(el, ['A', 'r', 't', 'i']);
|
|
2573
2576
|
await el.updateComplete;
|
|
2574
|
-
expect(_inputNode.value).to.equal('Arti', autocompleteMode);
|
|
2577
|
+
expect(_inputNode.value).to.equal('Arti', `autocompleteMode is ${autocompleteMode}`);
|
|
2575
2578
|
|
|
2576
2579
|
await el.updateComplete;
|
|
2577
|
-
expect(el.checkedIndex).to.equal(-1, autocompleteMode);
|
|
2580
|
+
expect(el.checkedIndex).to.equal(-1, `autocompleteMode is ${autocompleteMode}`);
|
|
2581
|
+
_inputNode.value = '';
|
|
2578
2582
|
}
|
|
2579
2583
|
|
|
2580
2584
|
el.autocomplete = 'none';
|
|
@@ -2648,7 +2652,7 @@ describe('lion-combobox', () => {
|
|
|
2648
2652
|
);
|
|
2649
2653
|
const options = el.formElements;
|
|
2650
2654
|
|
|
2651
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2655
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2652
2656
|
|
|
2653
2657
|
await el.updateComplete;
|
|
2654
2658
|
expect(options[0]).lightDom.to.equal(
|
|
@@ -2664,7 +2668,7 @@ describe('lion-combobox', () => {
|
|
|
2664
2668
|
`<div data-key>Victoria Plum</div><small>Prunus domestica</small>`,
|
|
2665
2669
|
);
|
|
2666
2670
|
|
|
2667
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'D');
|
|
2671
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'D');
|
|
2668
2672
|
|
|
2669
2673
|
await el.updateComplete;
|
|
2670
2674
|
expect(options[0]).lightDom.to.equal(`<div data-key>Artichoke</div><small>Cardoon</small>`);
|
|
@@ -2690,7 +2694,7 @@ describe('lion-combobox', () => {
|
|
|
2690
2694
|
</lion-combobox>
|
|
2691
2695
|
`)
|
|
2692
2696
|
);
|
|
2693
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2697
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2694
2698
|
await el.updateComplete;
|
|
2695
2699
|
expect(el.activeIndex).to.equal(1);
|
|
2696
2700
|
});
|
|
@@ -2735,7 +2739,7 @@ describe('lion-combobox', () => {
|
|
|
2735
2739
|
// does not set active at all until user selects
|
|
2736
2740
|
await setup(el, 'none');
|
|
2737
2741
|
|
|
2738
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2742
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2739
2743
|
await el.updateComplete;
|
|
2740
2744
|
expect(el.activeIndex).to.equal(-1);
|
|
2741
2745
|
expect(el.opened).to.be.true;
|
|
@@ -2749,7 +2753,7 @@ describe('lion-combobox', () => {
|
|
|
2749
2753
|
// does not set active at all until user selects
|
|
2750
2754
|
await setup(el, 'list');
|
|
2751
2755
|
|
|
2752
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2756
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2753
2757
|
await el.updateComplete;
|
|
2754
2758
|
expect(el.opened).to.be.true;
|
|
2755
2759
|
expect(el.activeIndex).to.equal(-1);
|
|
@@ -2762,9 +2766,9 @@ describe('lion-combobox', () => {
|
|
|
2762
2766
|
// Example 3. List with Inline Autocomplete (mostly, but with aria-autocomplete="inline")
|
|
2763
2767
|
await setup(el, 'inline');
|
|
2764
2768
|
|
|
2765
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), '');
|
|
2769
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), '');
|
|
2766
2770
|
await el.updateComplete;
|
|
2767
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2771
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2768
2772
|
await el.updateComplete;
|
|
2769
2773
|
await el.updateComplete;
|
|
2770
2774
|
expect(el.opened).to.be.true;
|
|
@@ -2781,9 +2785,9 @@ describe('lion-combobox', () => {
|
|
|
2781
2785
|
// https://www.w3.org/TR/wai-aria-practices/examples/combobox/aria1.1pattern/listbox-combo.html
|
|
2782
2786
|
// Example 3. List with Inline Autocomplete
|
|
2783
2787
|
await setup(el, 'both');
|
|
2784
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), '');
|
|
2788
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), '');
|
|
2785
2789
|
await el.updateComplete;
|
|
2786
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2790
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2787
2791
|
await el.updateComplete;
|
|
2788
2792
|
mimicKeyPress(_inputNode, 'Enter');
|
|
2789
2793
|
expect(el.activeIndex).to.equal(1);
|
|
@@ -2803,27 +2807,27 @@ describe('lion-combobox', () => {
|
|
|
2803
2807
|
);
|
|
2804
2808
|
const { _inputNode } = getComboboxMembers(el);
|
|
2805
2809
|
|
|
2806
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2810
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2807
2811
|
await el.updateComplete;
|
|
2808
2812
|
expect(el.activeIndex).to.equal(1);
|
|
2809
2813
|
|
|
2810
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2814
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2811
2815
|
await el.updateComplete;
|
|
2812
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'chi');
|
|
2816
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'chi');
|
|
2813
2817
|
// Chard no longer matches, so should switch active to Chicory
|
|
2814
2818
|
await el.updateComplete;
|
|
2815
2819
|
|
|
2816
2820
|
expect(el.activeIndex).to.equal(2);
|
|
2817
2821
|
|
|
2818
2822
|
// select artichoke
|
|
2819
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'artichoke');
|
|
2823
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'artichoke');
|
|
2820
2824
|
await el.updateComplete;
|
|
2821
2825
|
mimicKeyPress(_inputNode, 'Enter');
|
|
2822
2826
|
|
|
2823
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), '');
|
|
2827
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), '');
|
|
2824
2828
|
await el.updateComplete;
|
|
2825
2829
|
// change selection, active index should update to closest match
|
|
2826
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'vic');
|
|
2830
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'vic');
|
|
2827
2831
|
await el.updateComplete;
|
|
2828
2832
|
expect(el.activeIndex).to.equal(3);
|
|
2829
2833
|
});
|
|
@@ -2842,7 +2846,7 @@ describe('lion-combobox', () => {
|
|
|
2842
2846
|
const { _inputNode } = getComboboxMembers(el);
|
|
2843
2847
|
|
|
2844
2848
|
// Select something
|
|
2845
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2849
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'cha');
|
|
2846
2850
|
await el.updateComplete;
|
|
2847
2851
|
mimicKeyPress(_inputNode, 'Enter');
|
|
2848
2852
|
expect(el.activeIndex).to.equal(1);
|
|
@@ -2854,7 +2858,7 @@ describe('lion-combobox', () => {
|
|
|
2854
2858
|
el.formElements.forEach(option => expect(option.active).to.be.false);
|
|
2855
2859
|
|
|
2856
2860
|
// change selection, active index should update to closest match
|
|
2857
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'vic');
|
|
2861
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'vic');
|
|
2858
2862
|
await el.updateComplete;
|
|
2859
2863
|
expect(el.activeIndex).to.equal(3);
|
|
2860
2864
|
});
|
|
@@ -2906,7 +2910,7 @@ describe('lion-combobox', () => {
|
|
|
2906
2910
|
);
|
|
2907
2911
|
expect(el.formElements[1].active).to.equal(false);
|
|
2908
2912
|
|
|
2909
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2913
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2910
2914
|
await el.updateComplete;
|
|
2911
2915
|
expect(elProts._activeDescendantOwnerNode.getAttribute('aria-activedescendant')).to.equal(
|
|
2912
2916
|
null,
|
|
@@ -2931,7 +2935,7 @@ describe('lion-combobox', () => {
|
|
|
2931
2935
|
|
|
2932
2936
|
const el2Prots = getComboboxMembers(el2);
|
|
2933
2937
|
|
|
2934
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el2), 'ch');
|
|
2938
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el2), 'ch');
|
|
2935
2939
|
await el2.updateComplete;
|
|
2936
2940
|
expect(el2Prots._activeDescendantOwnerNode.getAttribute('aria-activedescendant')).to.equal(
|
|
2937
2941
|
el2.formElements[1].id,
|
|
@@ -2939,7 +2943,7 @@ describe('lion-combobox', () => {
|
|
|
2939
2943
|
expect(el2.formElements[1].active).to.equal(true);
|
|
2940
2944
|
|
|
2941
2945
|
el2.autocomplete = 'list';
|
|
2942
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2946
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
2943
2947
|
await el2.updateComplete;
|
|
2944
2948
|
expect(el2Prots._activeDescendantOwnerNode.getAttribute('aria-activedescendant')).to.equal(
|
|
2945
2949
|
el2.formElements[1].id,
|
|
@@ -2949,7 +2953,7 @@ describe('lion-combobox', () => {
|
|
|
2949
2953
|
|
|
2950
2954
|
it('adds aria-label to highlighted options', async () => {
|
|
2951
2955
|
const [el, options] = await fruitFixture({ autocomplete: 'both', matchMode: 'all' });
|
|
2952
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'choke');
|
|
2956
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'choke');
|
|
2953
2957
|
await el.updateComplete;
|
|
2954
2958
|
const labelledElement = options[0].querySelector('span[aria-label="Artichoke"]');
|
|
2955
2959
|
expect(labelledElement).to.not.be.null;
|
|
@@ -2969,7 +2973,7 @@ describe('lion-combobox', () => {
|
|
|
2969
2973
|
);
|
|
2970
2974
|
const options = el.formElements;
|
|
2971
2975
|
|
|
2972
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'choke');
|
|
2976
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'choke');
|
|
2973
2977
|
await el.updateComplete;
|
|
2974
2978
|
const labelledElement = options[0].querySelector('span[aria-label=" Artichoke Cardoon "]');
|
|
2975
2979
|
expect(labelledElement).to.not.be.null;
|
|
@@ -3054,7 +3058,7 @@ describe('lion-combobox', () => {
|
|
|
3054
3058
|
);
|
|
3055
3059
|
|
|
3056
3060
|
// activate opened listbox
|
|
3057
|
-
mimicUserTyping(el, 'ch');
|
|
3061
|
+
await mimicUserTyping(el, 'ch');
|
|
3058
3062
|
await el.updateComplete;
|
|
3059
3063
|
|
|
3060
3064
|
expect(el.opened).to.equal(true);
|
|
@@ -3077,7 +3081,7 @@ describe('lion-combobox', () => {
|
|
|
3077
3081
|
|
|
3078
3082
|
const { _inputNode } = getComboboxMembers(el);
|
|
3079
3083
|
|
|
3080
|
-
mimicUserTyping(el, 'art');
|
|
3084
|
+
await mimicUserTyping(el, 'art');
|
|
3081
3085
|
await el.updateComplete;
|
|
3082
3086
|
expect(el.opened).to.equal(true);
|
|
3083
3087
|
|
|
@@ -3102,7 +3106,7 @@ describe('lion-combobox', () => {
|
|
|
3102
3106
|
const { _inputNode } = getComboboxMembers(el);
|
|
3103
3107
|
const options = el.formElements;
|
|
3104
3108
|
|
|
3105
|
-
mimicUserTyping(el, 'art');
|
|
3109
|
+
await mimicUserTyping(el, 'art');
|
|
3106
3110
|
await el.updateComplete;
|
|
3107
3111
|
|
|
3108
3112
|
expect(el.opened).to.equal(true);
|
|
@@ -3132,7 +3136,7 @@ describe('lion-combobox', () => {
|
|
|
3132
3136
|
const { _inputNode } = getComboboxMembers(el);
|
|
3133
3137
|
const options = el.formElements;
|
|
3134
3138
|
|
|
3135
|
-
mimicUserTyping(el, 'art');
|
|
3139
|
+
await mimicUserTyping(el, 'art');
|
|
3136
3140
|
await el.updateComplete;
|
|
3137
3141
|
|
|
3138
3142
|
expect(el.opened).to.equal(true);
|
|
@@ -3205,7 +3209,7 @@ describe('lion-combobox', () => {
|
|
|
3205
3209
|
|
|
3206
3210
|
it('will suggest partial matches (in the middle of the word) when set to "all"', async () => {
|
|
3207
3211
|
const [el] = await fruitFixture();
|
|
3208
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'c');
|
|
3212
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'c');
|
|
3209
3213
|
await el.updateComplete;
|
|
3210
3214
|
expect(getFilteredOptionValues(/** @type {LionCombobox} */ (el))).to.eql([
|
|
3211
3215
|
'Artichoke',
|
|
@@ -3217,7 +3221,7 @@ describe('lion-combobox', () => {
|
|
|
3217
3221
|
|
|
3218
3222
|
it('will only suggest beginning matches when set to "begin"', async () => {
|
|
3219
3223
|
const [el] = await fruitFixture({ matchMode: 'begin' });
|
|
3220
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
3224
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'ch');
|
|
3221
3225
|
await el.updateComplete;
|
|
3222
3226
|
expect(getFilteredOptionValues(/** @type {LionCombobox} */ (el))).to.eql([
|
|
3223
3227
|
'Chard',
|
|
@@ -3236,10 +3240,10 @@ describe('lion-combobox', () => {
|
|
|
3236
3240
|
return option.value === curValue;
|
|
3237
3241
|
}
|
|
3238
3242
|
el.matchCondition = onlyExactMatches;
|
|
3239
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'Chicory');
|
|
3243
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'Chicory');
|
|
3240
3244
|
await el.updateComplete;
|
|
3241
3245
|
expect(getFilteredOptionValues(/** @type {LionCombobox} */ (el))).to.eql(['Chicory']);
|
|
3242
|
-
mimicUserTyping(/** @type {LionCombobox} */ (el), 'Chicor');
|
|
3246
|
+
await mimicUserTyping(/** @type {LionCombobox} */ (el), 'Chicor');
|
|
3243
3247
|
await el.updateComplete;
|
|
3244
3248
|
expect(getFilteredOptionValues(/** @type {LionCombobox} */ (el))).to.eql([]);
|
|
3245
3249
|
});
|