@nuralyui/select 0.0.5 → 0.1.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.
@@ -1,254 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-explicit-any */
3
- /**
4
- * @license
5
- * Copyright 2023 Google Laabidi Aymen
6
- * SPDX-License-Identifier: MIT
7
- */
8
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
9
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
10
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
11
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
12
- return c > 3 && r && Object.defineProperty(target, key, r), r;
13
- };
14
- import { LitElement, html } from 'lit';
15
- import { customElement, state } from 'lit/decorators.js';
16
- import '../select.component';
17
- import '../../dropdown/hy-dropdown.component';
18
- import '../../button/nr-button.component';
19
- import '../../tabs/tabs.component';
20
- import '../../input/input.component';
21
- let SlectDemoElement = class SlectDemoElement extends LitElement {
22
- constructor() {
23
- super(...arguments);
24
- this.options = [
25
- { value: 'abuja', label: 'Abuja' },
26
- { value: 'duplin', label: 'Duplin' },
27
- { value: 'nairobi', label: 'Nairobi' },
28
- { value: 'beirut', label: 'Beirut' },
29
- { value: 'prague', label: 'Prague' },
30
- { value: 'marrakech', label: 'Marrakech' },
31
- { value: 'buenos aires', label: 'Buenos Aires' },
32
- ];
33
- this.selectedOptions = [];
34
- }
35
- render() {
36
- return html `
37
- <h3>Default: single selection without default values</h3>
38
- <hy-select
39
- .options=${this.options}
40
- @changed=${(e) => {
41
- this.selectedOptions = e.detail.value;
42
- console.log(this.selectedOptions);
43
- }}
44
- >
45
- </hy-select>
46
- <br /><br />
47
- <br /><br />
48
-
49
- <hr />
50
- <br /><br />
51
- <h3>single selection with default values</h3>
52
-
53
- <hy-select
54
- .options=${this.options}
55
- .defaultSelected="${['Duplin']}"
56
- @changed=${(e) => {
57
- this.selectedOptions = e.detail.value;
58
- console.log(this.selectedOptions);
59
- }}
60
- >
61
- </hy-select>
62
- <br /><br />
63
- <br /><br />
64
-
65
- <hr />
66
- <br /><br />
67
- <h3>Disabled</h3>
68
-
69
- <hy-select
70
- .options=${this.options}
71
- .disabled=${true}
72
- @changed=${(e) => {
73
- this.selectedOptions = e.detail.value;
74
- console.log(this.selectedOptions);
75
- }}
76
- >
77
- <span slot="label">disabled input</span>
78
- <span slot="helper-text">helper</span>
79
- </hy-select>
80
-
81
- <br /><br />
82
- <br /><br />
83
- <hr />
84
- <br /><br />
85
- <h3>Multiple selection without default values</h3>
86
-
87
- <hy-select
88
- selectionMode="multiple"
89
- .options=${this.options}
90
- @changed=${(e) => {
91
- this.selectedOptions = e.detail.value;
92
- console.log(this.selectedOptions);
93
- }}
94
- >
95
- <span slot="label">Selection mode: multiple</span>
96
- </hy-select>
97
- <br /><br />
98
- <br /><br />
99
- <hr />
100
- <br /><br />
101
- <h3>single selection with default value</h3>
102
-
103
- <hy-select
104
- .defaultSelected="${['Abuja']}"
105
- .options=${this.options}
106
- @changed=${(e) => {
107
- this.selectedOptions = e.detail.value;
108
- console.log(this.selectedOptions);
109
- }}
110
- >
111
- <span slot="label">Selection mode: single, default selected: Abuja</span>
112
- </hy-select>
113
- <br /><br />
114
- <br /><br />
115
- <hr />
116
- <br /><br />
117
- <h3>Multiple selection with default values and empty placeholder</h3>
118
- <hy-select
119
- selectionMode="multiple"
120
- placeholder=""
121
- .defaultSelected="${['Abuja', 'Nairobi']}"
122
- .options=${this.options}
123
- @changed=${(e) => {
124
- this.selectedOptions = e.detail.value;
125
- console.log(this.selectedOptions);
126
- }}
127
- >
128
- <span slot="label">Selection Mode: multiple</span>
129
- </hy-select>
130
- <br /><br />
131
- <br /><br />
132
- <hr />
133
- <br /><br />
134
- <h3>Default with warning status</h3>
135
- <hy-select
136
- status="warning"
137
- .options=${this.options}
138
- @changed=${(e) => {
139
- this.selectedOptions = e.detail.value;
140
- console.log(this.selectedOptions);
141
- }}
142
- >
143
- <span slot="label">warning status</span>
144
- </hy-select>
145
- <br /><br />
146
- <br /><br />
147
- <h3>Disabled with warning status</h3>
148
- <hy-select
149
- status="warning"
150
- .disabled=${true}
151
- .options=${this.options}
152
- @changed=${(e) => {
153
- this.selectedOptions = e.detail.value;
154
- console.log(this.selectedOptions);
155
- }}
156
- >
157
- <span slot="label">warning status</span>
158
- </hy-select>
159
- <br /><br />
160
- <br /><br />
161
- <hr />
162
- <br /><br />
163
- <h3>Default with error status</h3>
164
- <hy-select
165
- status="error"
166
- .options=${this.options}
167
- @changed=${(e) => {
168
- this.selectedOptions = e.detail.value;
169
- console.log(this.selectedOptions);
170
- }}
171
- >
172
- <span slot="label">label</span>
173
- <span slot="helper-text">error status</span>
174
- </hy-select>
175
- <br /><br />
176
- <br /><br />
177
- <hr />
178
- <h3>Disabledwith error status</h3>
179
- <hy-select
180
- .disabled=${true}
181
- status="error"
182
- .options=${this.options}
183
- @changed=${(e) => {
184
- this.selectedOptions = e.detail.value;
185
- console.log(this.selectedOptions);
186
- }}
187
- >
188
- <span slot="label">label</span>
189
- <span slot="helper-text">error status</span>
190
- </hy-select>
191
- <br /><br />
192
- <br /><br />
193
- <hr />
194
- <br /><br />
195
- <h3>Default and type inline</h3>
196
-
197
- <hy-select
198
- type="inline"
199
- .options=${this.options}
200
- @changed=${(e) => {
201
- this.selectedOptions = e.detail.value;
202
- console.log(this.selectedOptions);
203
- }}
204
- >
205
- <span slot="label">type inline</span>
206
- <span slot="helper-text">label</span>
207
- </hy-select>
208
- <br /><br />
209
- <br /><br />
210
-
211
- <hr />
212
- <br /><br />
213
- <h3>Default with small size</h3>
214
-
215
- <hy-select
216
- size="small"
217
- .options=${this.options}
218
- @changed=${(e) => {
219
- this.selectedOptions = e.detail.value;
220
- console.log(this.selectedOptions);
221
- }}
222
- >
223
- <span slot="label">small select</span>
224
- </hy-select>
225
- <br /><br />
226
- <br /><br />
227
-
228
- <hr />
229
- <br /><br />
230
- <h3>Default with large size</h3>
231
- <hy-select
232
- size="large"
233
- .options=${this.options}
234
- @changed=${(e) => {
235
- this.selectedOptions = e.detail.value;
236
- console.log(this.selectedOptions);
237
- }}
238
- >
239
- <span slot="label">large select</span>
240
- </hy-select>
241
- `;
242
- }
243
- };
244
- __decorate([
245
- state()
246
- ], SlectDemoElement.prototype, "options", void 0);
247
- __decorate([
248
- state()
249
- ], SlectDemoElement.prototype, "selectedOptions", void 0);
250
- SlectDemoElement = __decorate([
251
- customElement('hy-select-demo')
252
- ], SlectDemoElement);
253
- export { SlectDemoElement };
254
- //# sourceMappingURL=select-demo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select-demo.js","sourceRoot":"","sources":["../../../../src/components/select/demo/select-demo.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,uDAAuD;AACvD;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,qBAAqB,CAAC;AAC7B,OAAO,sCAAsC,CAAC;AAC9C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,2BAA2B,CAAC;AACnC,OAAO,6BAA6B,CAAC;AAGrC,IAAa,gBAAgB,GAA7B,MAAa,gBAAiB,SAAQ,UAAU;IAAhD;;QAEE,YAAO,GAAG;YACR,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAC;YAChC,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAC;YAClC,EAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAC;YACpC,EAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAA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QACpC,CAAC;;;;;;;;;;;;;mBAaU,IAAI,CAAC,OAAO;mBACZ,CAAC,CAAM,EAAE,EAAE;YACpB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACpC,CAAC;;;;;;;;;;;;;;mBAcU,IAAI,CAAC,OAAO;mBACZ,CAAC,CAAM,EAAE,EAAE;YACpB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACpC,CAAC;;;;;;;;;;;;mBAYU,IAAI,CAAC,OAAO;mBACZ,CAAC,CAAM,EAAE,EAAE;YACpB,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;YACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACpC,CAAC;;;;KAIJ,CAAC;IACJ,CAAC;CACF,CAAA;AA5NC;IADC,KAAK,EAAE;iDASN;AAGF;IADC,KAAK,EAAE;yDACa;AAbV,gBAAgB;IAD5B,aAAa,CAAC,gBAAgB,CAAC;GACnB,gBAAgB,CA8N5B;SA9NY,gBAAgB","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\n\nimport '../select.component';\nimport '../../dropdown/hy-dropdown.component';\nimport '../../button/nr-button.component';\nimport '../../tabs/tabs.component';\nimport '../../input/input.component';\n\n@customElement('hy-select-demo')\nexport class SlectDemoElement extends LitElement {\n @state()\n options = [\n {value: 'abuja', label: 'Abuja'},\n {value: 'duplin', label: 'Duplin'},\n {value: 'nairobi', label: 'Nairobi'},\n {value: 'beirut', label: 'Beirut'},\n {value: 'prague', label: 'Prague'},\n {value: 'marrakech', label: 'Marrakech'},\n {value: 'buenos aires', label: 'Buenos Aires'},\n ];\n\n @state()\n selectedOptions = [];\n override render() {\n return html`\n <h3>Default: single selection without default values</h3>\n <hy-select\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n </hy-select>\n <br /><br />\n <br /><br />\n\n <hr />\n <br /><br />\n <h3>single selection with default values</h3>\n\n <hy-select\n .options=${this.options}\n .defaultSelected=\"${['Duplin']}\"\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n </hy-select>\n <br /><br />\n <br /><br />\n\n <hr />\n <br /><br />\n <h3>Disabled</h3>\n\n <hy-select\n .options=${this.options}\n .disabled=${true}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">disabled input</span>\n <span slot=\"helper-text\">helper</span>\n </hy-select>\n\n <br /><br />\n <br /><br />\n <hr />\n <br /><br />\n <h3>Multiple selection without default values</h3>\n\n <hy-select\n selectionMode=\"multiple\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">Selection mode: multiple</span>\n </hy-select>\n <br /><br />\n <br /><br />\n <hr />\n <br /><br />\n <h3>single selection with default value</h3>\n\n <hy-select\n .defaultSelected=\"${['Abuja']}\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">Selection mode: single, default selected: Abuja</span>\n </hy-select>\n <br /><br />\n <br /><br />\n <hr />\n <br /><br />\n <h3>Multiple selection with default values and empty placeholder</h3>\n <hy-select\n selectionMode=\"multiple\"\n placeholder=\"\"\n .defaultSelected=\"${['Abuja', 'Nairobi']}\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">Selection Mode: multiple</span>\n </hy-select>\n <br /><br />\n <br /><br />\n <hr />\n <br /><br />\n <h3>Default with warning status</h3>\n <hy-select\n status=\"warning\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">warning status</span>\n </hy-select>\n <br /><br />\n <br /><br />\n <h3>Disabled with warning status</h3>\n <hy-select\n status=\"warning\"\n .disabled=${true}\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">warning status</span>\n </hy-select>\n <br /><br />\n <br /><br />\n <hr />\n <br /><br />\n <h3>Default with error status</h3>\n <hy-select\n status=\"error\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">label</span>\n <span slot=\"helper-text\">error status</span>\n </hy-select>\n <br /><br />\n <br /><br />\n <hr />\n <h3>Disabledwith error status</h3>\n <hy-select\n .disabled=${true}\n status=\"error\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">label</span>\n <span slot=\"helper-text\">error status</span>\n </hy-select>\n <br /><br />\n <br /><br />\n <hr />\n <br /><br />\n <h3>Default and type inline</h3>\n\n <hy-select\n type=\"inline\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">type inline</span>\n <span slot=\"helper-text\">label</span>\n </hy-select>\n <br /><br />\n <br /><br />\n\n <hr />\n <br /><br />\n <h3>Default with small size</h3>\n\n <hy-select\n size=\"small\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">small select</span>\n </hy-select>\n <br /><br />\n <br /><br />\n\n <hr />\n <br /><br />\n <h3>Default with large size</h3>\n <hy-select\n size=\"large\"\n .options=${this.options}\n @changed=${(e: any) => {\n this.selectedOptions = e.detail.value;\n console.log(this.selectedOptions);\n }}\n >\n <span slot=\"label\">large select</span>\n </hy-select>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'hy-select-demo': SlectDemoElement;\n }\n}\n"]}
package/index.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/select/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
package/react.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/select/react.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,eAAO,MAAM,QAAQ;;;;;EAUnB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.component.d.ts","sourceRoot":"","sources":["../../../src/components/select/select.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,cAAc,EAAgB,MAAM,KAAK,CAAC;AAI9D,OAAO,EAAC,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAKrG,qBACa,iBAAkB,SAAQ,UAAU;IAC/C,OAAgB,MAAM,0BAAU;IAGhC,OAAO,EAAG,OAAO,EAAE,CAAC;IAEpB,eAAe,EAAC,MAAM,EAAE,CAAG;IAE3B,WAAW,SAAsB;IAEjC,QAAQ,UAAS;IAEjB,IAAI,aAAsB;IAE1B,aAAa,sBAA8B;IAE3C,IAAI,UAAS;IAEb,MAAM,eAAwB;IAE9B,IAAI,aAAqB;IAGzB,QAAQ,EAAE,OAAO,EAAE,CAAM;IAGzB,cAAc,EAAG,WAAW,CAAC;IAE7B,OAAO,EAAG,WAAW,CAAC;cAEH,OAAO,CAAC,kBAAkB,EAAE,cAAc,GAAG,IAAI;YActD,aAAa;IAM3B,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,mBAAmB;IAK3B,OAAO,CAAC,MAAM;cAKK,MAAM,IAAI,OAAO;CAiErC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.constant.d.ts","sourceRoot":"","sources":["../../../src/components/select/select.constant.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,eAAO,MAAM,0BAA0B,OAAO,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.style.d.ts","sourceRoot":"","sources":["../../../src/components/select/select.style.ts"],"names":[],"mappings":"AAyOA,eAAO,MAAM,MAAM,yBAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"select.types.d.ts","sourceRoot":"","sources":["../../../src/components/select/select.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,GAAG,CAAC;CACvB;AAED,oBAAY,UAAU;IACpB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AACD,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,oBAAY,mBAAmB;IAC7B,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AACD,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB"}
@@ -1,2 +0,0 @@
1
- import '../select.component';
2
- //# sourceMappingURL=select_test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select_test.d.ts","sourceRoot":"","sources":["../../../../src/components/select/test/select_test.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,CAAC"}
@@ -1,132 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { expect, fixture, html } from '@open-wc/testing';
11
- import '../select.component';
12
- import { OptionSelectionMode, OptionSize, OptionStatus, OptionType } from '../select.types';
13
- const options = [
14
- { value: 'abuja', label: 'Abuja' },
15
- { value: 'duplin', label: 'Duplin' },
16
- { value: 'nairobi', label: 'Nairobi' },
17
- { value: 'beirut', label: 'Beirut' },
18
- { value: 'prague', label: 'Prague' },
19
- ];
20
- suite('Hy-select', () => {
21
- test('init select', () => __awaiter(void 0, void 0, void 0, function* () {
22
- const el = yield fixture(html `<hy-select .options=${options}></hy-select>`);
23
- expect(el.show).to.be.false;
24
- expect(el.placeholder).to.equal('Select an option');
25
- expect(el.disabled).to.be.false;
26
- expect(el.selectionMode).to.equal(OptionSelectionMode.Single);
27
- expect(el.type).to.equal(OptionType.Default);
28
- expect(el.status).to.equal(OptionStatus.Default);
29
- expect(el.size).to.equal(OptionSize.Medium);
30
- expect(el.selected).to.deep.equal([]);
31
- expect(el.defaultSelected).to.deep.equal([]);
32
- }));
33
- test('should hide/show options', () => __awaiter(void 0, void 0, void 0, function* () {
34
- const el = yield fixture(html `<hy-select .options=${options}></hy-select>`);
35
- const wrapper = el.shadowRoot.querySelector('.wrapper');
36
- let displayedOptions = el.shadowRoot.querySelector('.options');
37
- let displayedStyle = window.getComputedStyle(displayedOptions).display;
38
- expect(el.show).to.equal(false);
39
- expect(displayedStyle).to.equal('none');
40
- wrapper.click();
41
- yield el.updateComplete;
42
- displayedOptions = el.shadowRoot.querySelector('.options');
43
- displayedStyle = window.getComputedStyle(displayedOptions).display;
44
- expect(el.show).to.be.true;
45
- expect(displayedStyle).to.equal('flex');
46
- expect(displayedOptions.children.length).to.equal(options.length);
47
- }));
48
- test('should not toggle show when select disabled', () => __awaiter(void 0, void 0, void 0, function* () {
49
- const el = yield fixture(html `<hy-select .options=${options} .disabled=${true}></hy-select>`);
50
- const wrapper = el.shadowRoot.querySelector('.wrapper');
51
- expect(el.show).to.equal(false);
52
- wrapper.click();
53
- yield el.updateComplete;
54
- expect(el.show).to.be.false;
55
- }));
56
- test('should dispatch change events', () => __awaiter(void 0, void 0, void 0, function* () {
57
- const el = yield fixture(html `<hy-select .options=${options} .show=${true}></hy-select>`);
58
- const wrapper = el.shadowRoot.querySelector('.wrapper');
59
- let dispatchChangeEvent = false;
60
- el.addEventListener('changed', () => {
61
- dispatchChangeEvent = true;
62
- });
63
- const displayedOption = wrapper.querySelector('.option');
64
- displayedOption.click();
65
- yield el.updateComplete;
66
- expect(dispatchChangeEvent).to.be.true;
67
- }));
68
- test('should select multiple options', () => __awaiter(void 0, void 0, void 0, function* () {
69
- const el = yield fixture(html `<hy-select
70
- .options=${options}
71
- .show=${true}
72
- selectionMode="multiple"
73
- ></hy-select>`);
74
- const wrapper = el.shadowRoot.querySelector('.wrapper');
75
- const displayedOption = wrapper.querySelectorAll('.option');
76
- expect(el.selected).to.deep.equal([]);
77
- displayedOption[0].click();
78
- yield el.updateComplete;
79
- expect(el.selected).to.deep.equal([options[0]]);
80
- displayedOption[2].click();
81
- expect(el.selected).to.deep.equal([options[0], options[2]]);
82
- }));
83
- test('should select one option', () => __awaiter(void 0, void 0, void 0, function* () {
84
- const el = yield fixture(html `<hy-select .options=${options} .show=${true}></hy-select>`);
85
- const wrapper = el.shadowRoot.querySelector('.wrapper');
86
- const displayedOption = wrapper.querySelectorAll('.option');
87
- expect(el.selected).to.deep.equal([]);
88
- displayedOption[0].click();
89
- yield el.updateComplete;
90
- expect(el.selected).to.deep.equal([options[0]]);
91
- displayedOption[2].click();
92
- expect(el.selected).to.deep.equal([options[2]]);
93
- }));
94
- suite('display default values', () => {
95
- test('should display default value when single default value provided in single selection mode', () => __awaiter(void 0, void 0, void 0, function* () {
96
- const defaultSelected = ['Abuja'];
97
- const el = yield fixture(html `<hy-select
98
- .options=${options}
99
- .show=${true}
100
- .defaultSelected="${defaultSelected}"
101
- ></hy-select>`);
102
- const option = options.find((option) => option.label == defaultSelected[0]);
103
- expect(el.selected).to.deep.equal([option]);
104
- }));
105
- test('should display first default option when multiple default values provided in single selection mode', () => __awaiter(void 0, void 0, void 0, function* () {
106
- const defaultSelected = ['Abuja', 'Nairobi'];
107
- const el = yield fixture(html `<hy-select
108
- .options=${options}
109
- .show=${true}
110
- .defaultSelected="${defaultSelected}"
111
- ></hy-select>`);
112
- const option = options.find((option) => option.label == defaultSelected[0]);
113
- expect(el.selected).to.deep.equal([option]);
114
- }));
115
- test('should display default option values when multiple default values provided in multiple selection mode', () => __awaiter(void 0, void 0, void 0, function* () {
116
- const defaultSelected = ['Abuja', 'Nairobi'];
117
- const el = yield fixture(html `<hy-select
118
- .options=${options}
119
- .show=${true}
120
- .defaultSelected="${defaultSelected}"
121
- selectionMode="multiple"
122
- ></hy-select>`);
123
- const selectedOptions = [];
124
- defaultSelected.forEach((label) => {
125
- const option = options.find((option) => option.label == label);
126
- selectedOptions.push(option);
127
- });
128
- expect(el.selected).to.deep.equal(selectedOptions);
129
- }));
130
- });
131
- });
132
- //# sourceMappingURL=select_test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"select_test.js","sourceRoot":"","sources":["../../../../src/components/select/test/select_test.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAC,MAAM,EAAE,OAAO,EAAE,IAAI,E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MAAM,OAAO,CAAC,IAAI,CAAA;mBACnC,OAAO;gBACV,IAAI;4BACQ,eAAe;oBACvB,CAAC,CAAC;YAChB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;YAE5E,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAA,CAAC,CAAC;QACH,IAAI,CAAC,uGAAuG,EAAE,GAAS,EAAE;YACvH,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC7C,MAAM,EAAE,GAAsB,MAAM,OAAO,CAAC,IAAI,CAAA;mBACnC,OAAO;gBACV,IAAI;4BACQ,eAAe;;oBAEvB,CAAC,CAAC;YAChB,MAAM,eAAe,GAAc,EAAE,CAAC;YACtC,eAAe,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAChC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAE,CAAC;gBAChE,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QACrD,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import {expect, fixture, html} from '@open-wc/testing';\nimport '../select.component';\nimport {HySelectComponent} from '../select.component';\nimport {IOption, OptionSelectionMode, OptionSize, OptionStatus, OptionType} from '../select.types';\nconst options = [\n {value: 'abuja', label: 'Abuja'},\n {value: 'duplin', label: 'Duplin'},\n {value: 'nairobi', label: 'Nairobi'},\n {value: 'beirut', label: 'Beirut'},\n {value: 'prague', label: 'Prague'},\n];\nsuite('Hy-select', () => {\n test('init select', async () => {\n const el: HySelectComponent = await fixture(html`<hy-select .options=${options}></hy-select>`);\n expect(el.show).to.be.false;\n expect(el.placeholder).to.equal('Select an option');\n expect(el.disabled).to.be.false;\n expect(el.selectionMode).to.equal(OptionSelectionMode.Single);\n expect(el.type).to.equal(OptionType.Default);\n expect(el.status).to.equal(OptionStatus.Default);\n expect(el.size).to.equal(OptionSize.Medium);\n expect(el.selected).to.deep.equal([]);\n expect(el.defaultSelected).to.deep.equal([]);\n });\n test('should hide/show options', async () => {\n const el: HySelectComponent = await fixture(html`<hy-select .options=${options}></hy-select>`);\n const wrapper: HTMLElement = el.shadowRoot!.querySelector('.wrapper')!;\n let displayedOptions: HTMLElement = el.shadowRoot!.querySelector('.options')!;\n let displayedStyle = window.getComputedStyle(displayedOptions).display;\n expect(el.show).to.equal(false);\n expect(displayedStyle).to.equal('none');\n wrapper.click();\n await el.updateComplete;\n displayedOptions = el.shadowRoot!.querySelector('.options')!;\n displayedStyle = window.getComputedStyle(displayedOptions).display;\n expect(el.show).to.be.true;\n expect(displayedStyle).to.equal('flex');\n expect(displayedOptions.children.length).to.equal(options.length);\n });\n test('should not toggle show when select disabled', async () => {\n const el: HySelectComponent = await fixture(html`<hy-select .options=${options} .disabled=${true}></hy-select>`);\n const wrapper: HTMLElement = el.shadowRoot!.querySelector('.wrapper')!;\n expect(el.show).to.equal(false);\n wrapper.click();\n await el.updateComplete;\n expect(el.show).to.be.false;\n });\n test('should dispatch change events', async () => {\n const el: HySelectComponent = await fixture(html`<hy-select .options=${options} .show=${true}></hy-select>`);\n const wrapper: HTMLElement = el.shadowRoot!.querySelector('.wrapper')!;\n let dispatchChangeEvent = false;\n el.addEventListener('changed', () => {\n dispatchChangeEvent = true;\n });\n const displayedOption: HTMLElement = wrapper.querySelector('.option')!;\n displayedOption.click();\n await el.updateComplete;\n expect(dispatchChangeEvent).to.be.true;\n });\n test('should select multiple options', async () => {\n const el: HySelectComponent = await fixture(html`<hy-select\n .options=${options}\n .show=${true}\n selectionMode=\"multiple\"\n ></hy-select>`);\n const wrapper: HTMLElement = el.shadowRoot!.querySelector('.wrapper')!;\n const displayedOption: NodeListOf<HTMLElement> = wrapper.querySelectorAll('.option')!;\n expect(el.selected).to.deep.equal([]);\n displayedOption[0].click();\n await el.updateComplete;\n expect(el.selected).to.deep.equal([options[0]]);\n displayedOption[2].click();\n expect(el.selected).to.deep.equal([options[0], options[2]]);\n });\n test('should select one option', async () => {\n const el: HySelectComponent = await fixture(html`<hy-select .options=${options} .show=${true}></hy-select>`);\n const wrapper: HTMLElement = el.shadowRoot!.querySelector('.wrapper')!;\n const displayedOption: NodeListOf<HTMLElement> = wrapper.querySelectorAll('.option')!;\n expect(el.selected).to.deep.equal([]);\n displayedOption[0].click();\n await el.updateComplete;\n expect(el.selected).to.deep.equal([options[0]]);\n displayedOption[2].click();\n expect(el.selected).to.deep.equal([options[2]]);\n });\n suite('display default values', () => {\n test('should display default value when single default value provided in single selection mode', async () => {\n const defaultSelected = ['Abuja'];\n const el: HySelectComponent = await fixture(html`<hy-select\n .options=${options}\n .show=${true}\n .defaultSelected=\"${defaultSelected}\"\n ></hy-select>`);\n const option = options.find((option) => option.label == defaultSelected[0]);\n expect(el.selected).to.deep.equal([option]);\n });\n test('should display first default option when multiple default values provided in single selection mode', async () => {\n const defaultSelected = ['Abuja', 'Nairobi'];\n const el: HySelectComponent = await fixture(html`<hy-select\n .options=${options}\n .show=${true}\n .defaultSelected=\"${defaultSelected}\"\n ></hy-select>`);\n const option = options.find((option) => option.label == defaultSelected[0]);\n\n expect(el.selected).to.deep.equal([option]);\n });\n test('should display default option values when multiple default values provided in multiple selection mode', async () => {\n const defaultSelected = ['Abuja', 'Nairobi'];\n const el: HySelectComponent = await fixture(html`<hy-select\n .options=${options}\n .show=${true}\n .defaultSelected=\"${defaultSelected}\"\n selectionMode=\"multiple\"\n ></hy-select>`);\n const selectedOptions: IOption[] = [];\n defaultSelected.forEach((label) => {\n const option = options.find((option) => option.label == label)!;\n selectedOptions.push(option);\n });\n\n expect(el.selected).to.deep.equal(selectedOptions);\n });\n });\n});\n"]}