@@ -185,4 +185,89 @@ describe('kup-input-panel', () => {
185
185
const updatedValue = await input . getProperty ( 'value' ) ;
186
186
expect ( updatedValue ) . toBe ( 'Rome' ) ;
187
187
} ) ;
188
+
189
+ it ( 'renders combobox' , async ( ) => {
190
+ const page = await newE2EPage ( ) ;
191
+
192
+ await page . setContent (
193
+ '<kup-input-panel></kup-input-panel> <div kup-dynamic-position></div>'
194
+ ) ;
195
+ const inputPanel = await page . find ( 'kup-input-panel' ) ;
196
+ const data = {
197
+ columns : [
198
+ {
199
+ name : 'NAT' ,
200
+ title : 'Nation' ,
201
+ visible : true ,
202
+ } ,
203
+ ] ,
204
+ rows : [
205
+ {
206
+ cells : {
207
+ NAT : {
208
+ value : '' ,
209
+ options : [
210
+ 'Italy' ,
211
+ 'Spain' ,
212
+ 'Germany' ,
213
+ 'France' ,
214
+ 'Portugal' ,
215
+ 'England' ,
216
+ ] ,
217
+ editable : true ,
218
+ shape : 'CMB' ,
219
+ } ,
220
+ } ,
221
+ } ,
222
+ ] ,
223
+ } ;
224
+
225
+ inputPanel . setProperty ( 'data' , data ) ;
226
+
227
+ await page . waitForChanges ( ) ;
228
+
229
+ const inputPanelContent = await page . find (
230
+ 'kup-input-panel >>> form.input-panel'
231
+ ) ;
232
+ expect ( inputPanelContent ) . not . toBeNull ( ) ;
233
+
234
+ const comboCell = await inputPanelContent . find ( '.f-cell.combobox-cell' ) ;
235
+ expect ( comboCell ) . not . toBeNull ( ) ;
236
+
237
+ const comboTextfield = await comboCell . find (
238
+ 'kup-combobox >>> div.f-text-field'
239
+ ) ;
240
+ expect ( comboTextfield ) . not . toBeNull ( ) ;
241
+
242
+ const label = await comboTextfield . find ( 'label' ) ;
243
+ expect ( label ) . not . toBeNull ( ) ;
244
+ expect ( label ) . toEqualText ( data . columns [ 0 ] . title ) ;
245
+
246
+ const input = await comboTextfield . find ( 'input' ) ;
247
+ expect ( input ) . not . toBeNull ( ) ;
248
+
249
+ const icon = await comboTextfield . find (
250
+ 'span.kup-icon.kup-dropdown-icon'
251
+ ) ;
252
+ expect ( icon ) . not . toBeNull ( ) ;
253
+
254
+ await icon . click ( ) ;
255
+
256
+ await page . waitForChanges ( ) ;
257
+ await page . waitForChanges ( ) ;
258
+
259
+ const list = await page . find ( 'div[kup-dynamic-position] kup-list' ) ;
260
+ expect ( list ) . not . toBeNull ( ) ;
261
+
262
+ const listOptions = await page . findAll ( 'kup-list >>> ul.list li' ) ;
263
+ expect ( listOptions ) . not . toBeNull ( ) ;
264
+ expect ( listOptions ) . toHaveLength ( data . rows [ 0 ] . cells . NAT . options . length ) ;
265
+
266
+ const firstOptionValue = await listOptions [ 0 ] . find ( 'span' ) ;
267
+ expect ( firstOptionValue ) . toEqualText ( 'Italy' ) ;
268
+ await firstOptionValue . click ( ) ;
269
+
270
+ const updatedValue = await input . getProperty ( 'value' ) ;
271
+ expect ( updatedValue ) . toBe ( 'Italy' ) ;
272
+ } ) ;
188
273
} ) ;
0 commit comments