@duetds/components 8.5.5 → 8.6.0
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/hydrate/index.js +289 -113
- package/lib/cjs/duet-alert.cjs.entry.js +1 -1
- package/lib/cjs/duet-banner.cjs.entry.js +1 -1
- package/lib/cjs/duet-callout.cjs.entry.js +1 -1
- package/lib/cjs/duet-chip.cjs.entry.js +9 -2
- package/lib/cjs/duet-choice_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-collapsible.cjs.entry.js +1 -1
- package/lib/cjs/duet-combobox.cjs.entry.js +260 -127
- package/lib/cjs/duet-date-picker.cjs.entry.js +1 -1
- package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
- package/lib/cjs/duet-hero.cjs.entry.js +1 -1
- package/lib/cjs/duet-input_2.cjs.entry.js +39 -3
- package/lib/cjs/duet-modal.cjs.entry.js +1 -1
- package/lib/cjs/duet-multiselect.cjs.entry.js +1 -1
- package/lib/cjs/duet-number-input.cjs.entry.js +1 -1
- package/lib/cjs/duet-promo-card.cjs.entry.js +1 -1
- package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-scrollable_3.cjs.entry.js +1 -1
- package/lib/cjs/duet-select.cjs.entry.js +1 -1
- package/lib/cjs/duet-slideout-panel.cjs.entry.js +1 -1
- package/lib/cjs/duet-slideout.cjs.entry.js +1 -1
- package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +1 -1
- package/lib/cjs/loader.cjs.js +1 -1
- package/lib/cjs/{slot-utils-f5073417.js → slot-utils-03a40c78.js} +3 -1
- package/lib/collection/components/duet-chip/duet-chip.css +7 -0
- package/lib/collection/components/duet-chip/duet-chip.js +29 -2
- package/lib/collection/components/duet-combobox/duet-combobox-select-single.js +2 -2
- package/lib/collection/components/duet-combobox/duet-combobox.css +10 -2
- package/lib/collection/components/duet-combobox/duet-combobox.e2e.js +81 -51
- package/lib/collection/components/duet-combobox/duet-combobox.js +321 -142
- package/lib/collection/components/duet-input/duet-input.css +29 -0
- package/lib/collection/components/duet-input/duet-input.js +159 -3
- package/lib/collection/utils/slot-utils.js +3 -1
- package/lib/dist-custom-elements/duet-action-button.js +1 -1
- package/lib/dist-custom-elements/duet-alert.js +1 -1
- package/lib/dist-custom-elements/duet-banner.js +1 -1
- package/lib/dist-custom-elements/duet-breadcrumb.js +1 -1
- package/lib/dist-custom-elements/duet-callout.js +1 -1
- package/lib/dist-custom-elements/duet-card.js +1 -1
- package/lib/dist-custom-elements/duet-chip.js +1 -273
- package/lib/dist-custom-elements/duet-choice-group.js +5 -5
- package/lib/dist-custom-elements/duet-choice.js +2 -2
- package/lib/dist-custom-elements/duet-collapsible.js +2 -2
- package/lib/dist-custom-elements/duet-combobox.js +326 -132
- package/lib/dist-custom-elements/duet-cookie-consent.js +1 -1
- package/lib/dist-custom-elements/duet-date-picker.js +6 -6
- package/lib/dist-custom-elements/duet-editable-table.js +2 -2
- package/lib/dist-custom-elements/duet-fieldset.js +1 -1
- package/lib/dist-custom-elements/duet-footer.js +1 -1
- package/lib/dist-custom-elements/duet-header.js +1 -1
- package/lib/dist-custom-elements/duet-hero.js +1 -1
- package/lib/dist-custom-elements/duet-input.js +1 -1
- package/lib/dist-custom-elements/duet-menu-bar-dropdown-link.js +1 -1
- package/lib/dist-custom-elements/duet-menu-bar-dropdown.js +1 -1
- package/lib/dist-custom-elements/duet-modal.js +2 -2
- package/lib/dist-custom-elements/duet-multiselect.js +5 -5
- package/lib/dist-custom-elements/duet-notification-drawer.js +1 -1
- package/lib/dist-custom-elements/duet-notification.js +1 -1
- package/lib/dist-custom-elements/duet-number-input.js +6 -6
- package/lib/dist-custom-elements/duet-pagination.js +6 -6
- package/lib/dist-custom-elements/duet-popup-menu.js +1 -1
- package/lib/dist-custom-elements/duet-promo-card.js +1 -1
- package/lib/dist-custom-elements/duet-radio-group.js +5 -5
- package/lib/dist-custom-elements/duet-range-slider.js +1 -1
- package/lib/dist-custom-elements/duet-range-stepper.js +2 -2
- package/lib/dist-custom-elements/duet-scrollable.js +1 -1
- package/lib/dist-custom-elements/duet-select.js +1 -1
- package/lib/dist-custom-elements/duet-show-more.js +1 -1
- package/lib/dist-custom-elements/duet-slideout-panel.js +1 -1
- package/lib/dist-custom-elements/duet-slideout.js +2 -2
- package/lib/dist-custom-elements/duet-step.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-dropdown-link.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-dropdown.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-item.js +1 -1
- package/lib/dist-custom-elements/duet-submenu-bar-link.js +1 -1
- package/lib/dist-custom-elements/duet-tab-group.js +6 -6
- package/lib/dist-custom-elements/duet-tab.js +1 -1
- package/lib/dist-custom-elements/duet-textarea.js +4 -4
- package/lib/dist-custom-elements/duet-toggle.js +1 -1
- package/lib/dist-custom-elements/duet-toolbar-dropdown-link.js +1 -1
- package/lib/dist-custom-elements/duet-toolbar-dropdown.js +1 -1
- package/lib/dist-custom-elements/duet-tooltip-button.js +1 -1
- package/lib/dist-custom-elements/duet-tooltip-popup.js +1 -1
- package/lib/dist-custom-elements/duet-tooltip.js +1 -1
- package/lib/dist-custom-elements/duet-tray.js +1 -1
- package/lib/dist-custom-elements/duet-upload-item.js +1 -1
- package/lib/dist-custom-elements/duet-upload.js +5 -5
- package/lib/dist-custom-elements/{p-cff358b0.js → p-014c1177.js} +49 -8
- package/lib/dist-custom-elements/{p-c3d02eb2.js → p-03152b20.js} +1 -1
- package/lib/dist-custom-elements/{p-d87f6dd5.js → p-06e608ae.js} +3 -1
- package/lib/dist-custom-elements/{p-9cdbc360.js → p-0cee8a12.js} +1 -1
- package/lib/dist-custom-elements/{p-12a0876b.js → p-24693e9a.js} +1 -1
- package/lib/dist-custom-elements/{p-9a833e56.js → p-28ec3461.js} +1 -1
- package/lib/dist-custom-elements/{p-d191ba9e.js → p-45fd4d84.js} +1 -1
- package/lib/dist-custom-elements/{p-89d58b60.js → p-6d366100.js} +3 -3
- package/lib/dist-custom-elements/p-755dd68f.js +285 -0
- package/lib/dist-custom-elements/{p-e44c0eff.js → p-785686e3.js} +1 -1
- package/lib/dist-custom-elements/{p-e00d43f3.js → p-92a16064.js} +1 -1
- package/lib/dist-custom-elements/{p-f9f9e33d.js → p-a02e62f3.js} +3 -3
- package/lib/dist-custom-elements/{p-0d5c0a22.js → p-c8415e2f.js} +1 -1
- package/lib/dist-custom-elements/{p-d848b48d.js → p-e702eb52.js} +4 -4
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/{p-88a46585.system.entry.js → p-061f4be0.system.entry.js} +1 -1
- package/lib/duet/p-06e608ae.js +4 -0
- package/lib/duet/{p-8ca813cb.system.entry.js → p-0778ccde.system.entry.js} +1 -1
- package/lib/duet/p-07ac7f3e.system.entry.js +4 -0
- package/lib/duet/p-15e24bf0.entry.js +4 -0
- package/lib/duet/{p-0dac34a4.system.entry.js → p-1ef0e5ca.system.entry.js} +1 -1
- package/lib/duet/{p-c9781f22.entry.js → p-2084a65f.entry.js} +1 -1
- package/lib/duet/{p-fd0bb0bf.entry.js → p-23cecf9f.entry.js} +1 -1
- package/lib/duet/{p-09e4195f.system.entry.js → p-257800b7.system.entry.js} +1 -1
- package/lib/duet/{p-1afd901a.entry.js → p-29491f9f.entry.js} +1 -1
- package/lib/duet/{p-3b5ff822.entry.js → p-3302d75d.entry.js} +1 -1
- package/lib/duet/{p-7629cd0a.entry.js → p-40375e30.entry.js} +1 -1
- package/lib/duet/{p-ba4445cf.system.entry.js → p-45bb3cd0.system.entry.js} +1 -1
- package/lib/duet/p-4781cd58.entry.js +4 -0
- package/lib/duet/p-4cb5943c.entry.js +4 -0
- package/lib/duet/{p-b2f2992f.system.entry.js → p-4de910bd.system.entry.js} +1 -1
- package/lib/duet/p-6151635f.system.js +1 -1
- package/lib/duet/{p-d349dd93.entry.js → p-67382632.entry.js} +1 -1
- package/lib/duet/{p-699a98b4.entry.js → p-76e54ff5.entry.js} +1 -1
- package/lib/duet/{p-4d2ef0e2.entry.js → p-7a161455.entry.js} +1 -1
- package/lib/duet/{p-3d38079c.entry.js → p-7ca15c93.entry.js} +1 -1
- package/lib/duet/{p-bb09fff0.system.entry.js → p-7de614df.system.entry.js} +1 -1
- package/lib/duet/{p-480f37b6.entry.js → p-83238fe7.entry.js} +1 -1
- package/lib/duet/{p-7c1db591.system.entry.js → p-8a4ba903.system.entry.js} +1 -1
- package/lib/duet/{p-4f32a7ee.entry.js → p-8ba91848.entry.js} +1 -1
- package/lib/duet/{p-708359ec.system.entry.js → p-999fff8d.system.entry.js} +1 -1
- package/lib/duet/{p-9d91a1dd.system.entry.js → p-9e75e5d8.system.entry.js} +1 -1
- package/lib/duet/{p-343d037e.entry.js → p-a3afb1af.entry.js} +1 -1
- package/lib/duet/{p-2ca6a8a0.system.entry.js → p-a3e90064.system.entry.js} +1 -1
- package/lib/duet/{p-892a5644.system.entry.js → p-aba91113.system.entry.js} +1 -1
- package/lib/duet/p-ae21ad57.system.js +4 -0
- package/lib/duet/{p-ce05fe6d.system.entry.js → p-b2fc4b72.system.entry.js} +1 -1
- package/lib/duet/{p-84778369.entry.js → p-b5595969.entry.js} +1 -1
- package/lib/duet/{p-bf51f8a5.system.entry.js → p-c68602c9.system.entry.js} +1 -1
- package/lib/duet/{p-f6530332.system.entry.js → p-d5721f0d.system.entry.js} +1 -1
- package/lib/duet/{p-c00fe4ed.entry.js → p-dc133655.entry.js} +1 -1
- package/lib/duet/p-de5054b6.system.entry.js +4 -0
- package/lib/duet/{p-61feb701.entry.js → p-df345202.entry.js} +1 -1
- package/lib/duet/{p-2628a322.entry.js → p-e0907f29.entry.js} +1 -1
- package/lib/duet/p-e333b9fc.system.entry.js +4 -0
- package/lib/duet/p-e411627f.entry.js +4 -0
- package/lib/duet/{p-da51c71f.system.entry.js → p-eafed149.system.entry.js} +1 -1
- package/lib/duet/p-f2279e1e.entry.js +4 -0
- package/lib/duet/{p-b1ab1664.system.entry.js → p-fa311641.system.entry.js} +1 -1
- package/lib/duet/{p-320318de.system.entry.js → p-fa72c79b.system.entry.js} +1 -1
- package/lib/esm/duet-alert.entry.js +1 -1
- package/lib/esm/duet-banner.entry.js +1 -1
- package/lib/esm/duet-callout.entry.js +1 -1
- package/lib/esm/duet-chip.entry.js +9 -2
- package/lib/esm/duet-choice_2.entry.js +1 -1
- package/lib/esm/duet-collapsible.entry.js +1 -1
- package/lib/esm/duet-combobox.entry.js +261 -128
- package/lib/esm/duet-date-picker.entry.js +1 -1
- package/lib/esm/duet-fieldset.entry.js +1 -1
- package/lib/esm/duet-hero.entry.js +1 -1
- package/lib/esm/duet-input_2.entry.js +39 -3
- package/lib/esm/duet-modal.entry.js +1 -1
- package/lib/esm/duet-multiselect.entry.js +1 -1
- package/lib/esm/duet-number-input.entry.js +1 -1
- package/lib/esm/duet-promo-card.entry.js +1 -1
- package/lib/esm/duet-radio_2.entry.js +1 -1
- package/lib/esm/duet-scrollable_3.entry.js +1 -1
- package/lib/esm/duet-select.entry.js +1 -1
- package/lib/esm/duet-slideout-panel.entry.js +1 -1
- package/lib/esm/duet-slideout.entry.js +1 -1
- package/lib/esm/duet-textarea.entry.js +1 -1
- package/lib/esm/duet.js +1 -1
- package/lib/esm/loader.js +1 -1
- package/lib/esm/{slot-utils-1115a819.js → slot-utils-b50aaef5.js} +3 -1
- package/lib/esm-es5/duet-alert.entry.js +1 -1
- package/lib/esm-es5/duet-banner.entry.js +1 -1
- package/lib/esm-es5/duet-callout.entry.js +1 -1
- package/lib/esm-es5/duet-chip.entry.js +1 -1
- package/lib/esm-es5/duet-choice_2.entry.js +1 -1
- package/lib/esm-es5/duet-collapsible.entry.js +1 -1
- package/lib/esm-es5/duet-combobox.entry.js +2 -2
- package/lib/esm-es5/duet-date-picker.entry.js +1 -1
- package/lib/esm-es5/duet-fieldset.entry.js +1 -1
- package/lib/esm-es5/duet-hero.entry.js +1 -1
- package/lib/esm-es5/duet-input_2.entry.js +2 -2
- package/lib/esm-es5/duet-modal.entry.js +1 -1
- package/lib/esm-es5/duet-multiselect.entry.js +1 -1
- package/lib/esm-es5/duet-number-input.entry.js +2 -2
- package/lib/esm-es5/duet-promo-card.entry.js +2 -2
- package/lib/esm-es5/duet-radio_2.entry.js +1 -1
- package/lib/esm-es5/duet-scrollable_3.entry.js +1 -1
- package/lib/esm-es5/duet-select.entry.js +1 -1
- package/lib/esm-es5/duet-slideout-panel.entry.js +1 -1
- package/lib/esm-es5/duet-slideout.entry.js +1 -1
- package/lib/esm-es5/duet-textarea.entry.js +1 -1
- package/lib/esm-es5/duet.js +1 -1
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/slot-utils-b50aaef5.js +4 -0
- package/lib/types/components/duet-chip/duet-chip.d.ts +4 -0
- package/lib/types/components/duet-combobox/duet-combobox.d.ts +49 -35
- package/lib/types/components/duet-input/duet-input.d.ts +30 -0
- package/lib/types/components.d.ts +44 -21
- package/package.json +2 -2
- package/lib/duet/p-7cf03aa8.system.js +0 -4
- package/lib/duet/p-92e1181c.entry.js +0 -4
- package/lib/duet/p-985c0c67.system.entry.js +0 -4
- package/lib/duet/p-9d27bc65.entry.js +0 -4
- package/lib/duet/p-afe29a3e.entry.js +0 -4
- package/lib/duet/p-cc4a8964.entry.js +0 -4
- package/lib/duet/p-d50ad3ed.entry.js +0 -4
- package/lib/duet/p-d87f6dd5.js +0 -4
- package/lib/duet/p-f1b01db9.system.entry.js +0 -4
- package/lib/duet/p-fa21a3b6.system.entry.js +0 -4
- package/lib/esm-es5/slot-utils-1115a819.js +0 -4
|
@@ -2,18 +2,27 @@
|
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
4
|
import { createPage } from "../../utils/test-utils";
|
|
5
|
+
const items = [
|
|
6
|
+
{ id: 0, value: "49200", name: "Heinlahti" },
|
|
7
|
+
{ id: 1, value: "49210", name: "Huutjarvi" },
|
|
8
|
+
{ id: 2, value: "49220", name: "Siltakyla" },
|
|
9
|
+
{ id: 3, value: "49240", name: "Purola" },
|
|
10
|
+
{ id: 4, value: "49270", name: "Something" },
|
|
11
|
+
{ id: 5, value: "49290", name: "Vastila" },
|
|
12
|
+
];
|
|
5
13
|
const createPageWithCombobox = async () => {
|
|
6
|
-
const combobox = `<duet-combobox
|
|
14
|
+
const combobox = `<duet-combobox><duet-input label="Example" expand></duet-input></duet-combobox>`;
|
|
7
15
|
const page = await createPage(combobox);
|
|
8
16
|
await page.$eval("duet-combobox", (combobox, props) => Object.assign(combobox, props), {
|
|
9
|
-
items
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
items,
|
|
18
|
+
});
|
|
19
|
+
return page;
|
|
20
|
+
};
|
|
21
|
+
const createPageWithMultiCombobox = async () => {
|
|
22
|
+
const combobox = `<duet-combobox multiple></duet-combobox>`;
|
|
23
|
+
const page = await createPage(combobox);
|
|
24
|
+
await page.$eval("duet-combobox", (combobox, props) => Object.assign(combobox, props), {
|
|
25
|
+
items,
|
|
17
26
|
});
|
|
18
27
|
return page;
|
|
19
28
|
};
|
|
@@ -23,101 +32,122 @@ describe("duet-combobox", () => {
|
|
|
23
32
|
const component = await page.find("duet-combobox");
|
|
24
33
|
expect(component).not.toBeNull();
|
|
25
34
|
});
|
|
26
|
-
it("
|
|
35
|
+
it("allows typing in input", async () => {
|
|
36
|
+
const page = await createPageWithCombobox();
|
|
37
|
+
const element = await page.find("duet-combobox");
|
|
38
|
+
const input = await element.find("duet-input .duet-input");
|
|
39
|
+
await input.click();
|
|
40
|
+
await page.keyboard.type("Loremipsum", { delay: 150 });
|
|
41
|
+
expect(await input.getProperty("value")).toBe("Loremipsum");
|
|
42
|
+
expect(await element.getProperty("value")).toBeFalsy();
|
|
43
|
+
});
|
|
44
|
+
it("allows selecting item with keyboard", async () => {
|
|
27
45
|
const page = await createPageWithCombobox();
|
|
28
46
|
const element = await page.find("duet-combobox");
|
|
29
47
|
const input = await element.find("duet-input .duet-input");
|
|
30
48
|
await input.click();
|
|
31
|
-
// type some chars that match the values in the combobox
|
|
32
49
|
await page.keyboard.type("H", { delay: 150 });
|
|
33
50
|
await page.keyboard.press("ArrowDown", { delay: 150 });
|
|
34
|
-
// move cursor so we can test maintaining position
|
|
35
51
|
await page.keyboard.press("Enter");
|
|
36
52
|
await page.waitForChanges();
|
|
37
|
-
// check the value
|
|
38
53
|
expect(await input.getProperty("value")).toBe("Heinlahti");
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
54
|
+
expect(await element.getProperty("value")).toBe("49200");
|
|
55
|
+
});
|
|
56
|
+
it("keeps independent combobox and input values on blur", async () => {
|
|
57
|
+
const page = await createPageWithCombobox();
|
|
58
|
+
const element = await page.find("duet-combobox");
|
|
59
|
+
const input = await element.find("duet-input .duet-input");
|
|
60
|
+
await input.click();
|
|
61
|
+
await page.keyboard.type("H", { delay: 150 });
|
|
62
|
+
await page.keyboard.press("ArrowDown", { delay: 150 });
|
|
63
|
+
await page.keyboard.press("Enter");
|
|
64
|
+
await page.waitForChanges();
|
|
65
|
+
await page.keyboard.type("Loremipsum", { delay: 50 });
|
|
42
66
|
await page.keyboard.press("Tab");
|
|
43
|
-
// we should see value hasn't changed
|
|
44
67
|
await page.waitForChanges();
|
|
45
|
-
expect(await input.getProperty("value")).toBe("
|
|
68
|
+
expect(await input.getProperty("value")).toBe("HeinlahtiLoremipsum");
|
|
69
|
+
expect(await element.getProperty("value")).toBe("49200");
|
|
46
70
|
});
|
|
47
|
-
it("
|
|
71
|
+
it("clears input on blur if forced and no selection made", async () => {
|
|
48
72
|
const page = await createPageWithCombobox();
|
|
49
73
|
const element = await page.find("duet-combobox");
|
|
50
74
|
const input = await element.find("duet-input .duet-input");
|
|
51
|
-
|
|
75
|
+
element.setProperty("force", true);
|
|
76
|
+
await page.waitForChanges();
|
|
52
77
|
await page.keyboard.press("Tab");
|
|
53
|
-
// type some chars that match the values in the combobox
|
|
54
78
|
await page.keyboard.type("Heinlah", { delay: 50 });
|
|
55
|
-
|
|
56
|
-
await page.keyboard.press("Escape");
|
|
79
|
+
await page.keyboard.press("Tab");
|
|
57
80
|
await page.waitForChanges();
|
|
58
|
-
// check the value
|
|
59
81
|
expect(await input.getProperty("value")).toBe("");
|
|
82
|
+
expect(await element.getProperty("value")).toBeFalsy();
|
|
60
83
|
});
|
|
61
|
-
it("
|
|
84
|
+
it("reverts input value to the selected item on blur if forced", async () => {
|
|
62
85
|
const page = await createPageWithCombobox();
|
|
63
|
-
const targetValue = "Heinlahti";
|
|
64
86
|
const element = await page.find("duet-combobox");
|
|
65
87
|
const input = await element.find("duet-input .duet-input");
|
|
66
|
-
|
|
88
|
+
element.setProperty("force", true);
|
|
89
|
+
await page.waitForChanges();
|
|
67
90
|
await page.keyboard.press("Tab");
|
|
68
|
-
// type some chars that match the values in the combobox
|
|
69
91
|
await page.keyboard.type("Heinlah", { delay: 50 });
|
|
70
|
-
// move cursor so we can test maintaining position
|
|
71
92
|
await page.keyboard.press("ArrowDown");
|
|
72
93
|
await page.keyboard.press("Enter");
|
|
73
|
-
//for each letter there is in the string targetValue we need to press backspace
|
|
74
|
-
for (let i = 0; i < targetValue.length; i++) {
|
|
75
|
-
await page.keyboard.press("Backspace");
|
|
76
|
-
}
|
|
77
|
-
// type some chars that match the values in the combobox
|
|
78
|
-
await page.keyboard.type("Pyhtää", { delay: 50 });
|
|
79
|
-
// send escape
|
|
80
|
-
await page.keyboard.press("Escape");
|
|
81
94
|
await page.waitForChanges();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
95
|
+
await page.keyboard.type("Loremipsum", { delay: 50 });
|
|
96
|
+
await page.keyboard.press("Tab");
|
|
97
|
+
await page.waitForChanges();
|
|
98
|
+
expect(await input.getProperty("value")).toBe("Heinlahti");
|
|
99
|
+
expect(await element.getProperty("value")).toBe("49200");
|
|
85
100
|
});
|
|
86
101
|
it("shows dropdown navigable via keys", async () => {
|
|
87
102
|
const page = await createPageWithCombobox();
|
|
88
103
|
const element = await page.find("duet-combobox");
|
|
89
104
|
const input = await element.find("duet-input .duet-input");
|
|
90
|
-
// focus on input
|
|
91
105
|
await input.click();
|
|
92
|
-
// type some chars that match the values in the combobox
|
|
93
106
|
await page.keyboard.type("H", { delay: 150 });
|
|
94
|
-
// send keys to navigate
|
|
95
107
|
await page.keyboard.press("ArrowDown", { delay: 150 });
|
|
96
108
|
await page.keyboard.press("ArrowDown", { delay: 150 });
|
|
97
109
|
await page.keyboard.press("Enter", { delay: 50 });
|
|
98
|
-
// tab to input
|
|
99
110
|
await page.keyboard.press("Tab", { delay: 500 });
|
|
100
111
|
await page.waitForChanges();
|
|
101
|
-
// check the value
|
|
102
112
|
expect(await input.getProperty("value")).toBe("Huutjarvi");
|
|
113
|
+
expect(await element.getProperty("value")).toBe("49210");
|
|
103
114
|
});
|
|
104
115
|
it("allows filtering middle of string", async () => {
|
|
105
116
|
const page = await createPageWithCombobox();
|
|
106
117
|
const element = await page.find("duet-combobox");
|
|
118
|
+
const input = await element.find("duet-input .duet-input");
|
|
107
119
|
element.setProperty("filterType", "includes");
|
|
108
120
|
await page.waitForChanges();
|
|
109
|
-
const input = await element.find("duet-input .duet-input");
|
|
110
|
-
// focus on input
|
|
111
121
|
await input.click();
|
|
112
|
-
// type some chars that match the values in the combobox
|
|
113
122
|
await page.keyboard.type("uu", { delay: 150 });
|
|
114
|
-
// send keys to navigate
|
|
115
123
|
await page.keyboard.press("ArrowDown", { delay: 150 });
|
|
116
124
|
await page.keyboard.press("Enter", { delay: 50 });
|
|
117
|
-
// tab to input
|
|
118
125
|
await page.keyboard.press("Tab", { delay: 500 });
|
|
119
126
|
await page.waitForChanges();
|
|
120
|
-
// check the value
|
|
121
127
|
expect(await input.getProperty("value")).toBe("Huutjarvi");
|
|
128
|
+
expect(await element.getProperty("value")).toBe("49210");
|
|
129
|
+
});
|
|
130
|
+
it("will add input if not provided in slot", async () => {
|
|
131
|
+
const page = await createPageWithMultiCombobox();
|
|
132
|
+
const element = await page.find("duet-combobox");
|
|
133
|
+
const input = await element.find("duet-input .duet-input");
|
|
134
|
+
expect(input).not.toBeNull();
|
|
135
|
+
});
|
|
136
|
+
it("allows selection of multiple items", async () => {
|
|
137
|
+
const page = await createPageWithMultiCombobox();
|
|
138
|
+
const element = await page.find("duet-combobox");
|
|
139
|
+
const input = await element.find("duet-input .duet-input");
|
|
140
|
+
await input.click();
|
|
141
|
+
// Select { id: 3, value: "49240", name: "Purola" }
|
|
142
|
+
await page.keyboard.type("pu", { delay: 150 });
|
|
143
|
+
await page.keyboard.press("ArrowDown", { delay: 150 });
|
|
144
|
+
await page.keyboard.press("Enter", { delay: 50 });
|
|
145
|
+
// Select { id: 5, value: "49290", name: "Vastila" }
|
|
146
|
+
await page.keyboard.type("va", { delay: 150 });
|
|
147
|
+
await page.keyboard.press("ArrowDown", { delay: 150 });
|
|
148
|
+
await page.keyboard.press("Enter", { delay: 50 });
|
|
149
|
+
expect(await input.getProperty("value")).toBe("");
|
|
150
|
+
expect(await element.find("duet-chip")).not.toBeNull();
|
|
151
|
+
expect(await element.getProperty("value")).toEqual(["49240", "49290"]);
|
|
122
152
|
});
|
|
123
153
|
});
|