quasar 2.7.0 → 2.7.3

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.
Files changed (154) hide show
  1. package/dist/api/QDialog.json +6 -0
  2. package/dist/api/QPagination.json +1 -1
  3. package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
  4. package/dist/icon-set/eva-icons.umd.prod.js +1 -1
  5. package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
  6. package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
  7. package/dist/icon-set/fontawesome-v6-pro.umd.prod.js +1 -1
  8. package/dist/icon-set/fontawesome-v6.umd.prod.js +1 -1
  9. package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
  10. package/dist/icon-set/line-awesome.umd.prod.js +1 -1
  11. package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
  12. package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
  13. package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
  14. package/dist/icon-set/material-icons.umd.prod.js +1 -1
  15. package/dist/icon-set/material-symbols-outlined.umd.prod.js +2 -2
  16. package/dist/icon-set/material-symbols-rounded.umd.prod.js +1 -1
  17. package/dist/icon-set/material-symbols-sharp.umd.prod.js +1 -1
  18. package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
  19. package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
  20. package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
  21. package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
  22. package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
  23. package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
  24. package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
  25. package/dist/icon-set/svg-fontawesome-v6.umd.prod.js +1 -1
  26. package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
  27. package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
  28. package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
  29. package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
  30. package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
  31. package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
  32. package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
  33. package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
  34. package/dist/icon-set/svg-material-symbols-outlined.umd.prod.js +2 -2
  35. package/dist/icon-set/svg-material-symbols-rounded.umd.prod.js +1 -1
  36. package/dist/icon-set/svg-material-symbols-sharp.umd.prod.js +1 -1
  37. package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
  38. package/dist/icon-set/svg-themify.umd.prod.js +1 -1
  39. package/dist/icon-set/themify.umd.prod.js +1 -1
  40. package/dist/lang/ar-TN.umd.prod.js +1 -1
  41. package/dist/lang/ar.umd.prod.js +1 -1
  42. package/dist/lang/az-Latn.umd.prod.js +1 -1
  43. package/dist/lang/bg.umd.prod.js +1 -1
  44. package/dist/lang/bn.umd.prod.js +1 -1
  45. package/dist/lang/ca.umd.prod.js +2 -2
  46. package/dist/lang/cs.umd.prod.js +1 -1
  47. package/dist/lang/da.umd.prod.js +1 -1
  48. package/dist/lang/de.umd.prod.js +1 -1
  49. package/dist/lang/el.umd.prod.js +1 -1
  50. package/dist/lang/en-GB.umd.prod.js +1 -1
  51. package/dist/lang/en-US.umd.prod.js +1 -1
  52. package/dist/lang/eo.umd.prod.js +1 -1
  53. package/dist/lang/es.umd.prod.js +1 -1
  54. package/dist/lang/et.umd.prod.js +1 -1
  55. package/dist/lang/eu.umd.prod.js +1 -1
  56. package/dist/lang/fa-IR.umd.prod.js +1 -1
  57. package/dist/lang/fa.umd.prod.js +1 -1
  58. package/dist/lang/fi.umd.prod.js +1 -1
  59. package/dist/lang/fr.umd.prod.js +1 -1
  60. package/dist/lang/gn.umd.prod.js +1 -1
  61. package/dist/lang/he.umd.prod.js +1 -1
  62. package/dist/lang/hr.umd.prod.js +1 -1
  63. package/dist/lang/hu.umd.prod.js +1 -1
  64. package/dist/lang/id.umd.prod.js +1 -1
  65. package/dist/lang/is.umd.prod.js +1 -1
  66. package/dist/lang/it.umd.prod.js +1 -1
  67. package/dist/lang/ja.umd.prod.js +1 -1
  68. package/dist/lang/km.umd.prod.js +1 -1
  69. package/dist/lang/ko-KR.umd.prod.js +2 -2
  70. package/dist/lang/kur-CKB.umd.prod.js +1 -1
  71. package/dist/lang/kz.umd.prod.js +1 -1
  72. package/dist/lang/lt.umd.prod.js +1 -1
  73. package/dist/lang/lu.umd.prod.js +1 -1
  74. package/dist/lang/lv.umd.prod.js +1 -1
  75. package/dist/lang/ml.umd.prod.js +1 -1
  76. package/dist/lang/mm.umd.prod.js +1 -1
  77. package/dist/lang/ms.umd.prod.js +1 -1
  78. package/dist/lang/my.umd.prod.js +1 -1
  79. package/dist/lang/nb-NO.umd.prod.js +1 -1
  80. package/dist/lang/nl.umd.prod.js +1 -1
  81. package/dist/lang/pl.umd.prod.js +1 -1
  82. package/dist/lang/pt-BR.umd.prod.js +1 -1
  83. package/dist/lang/pt.umd.prod.js +1 -1
  84. package/dist/lang/ro.umd.prod.js +1 -1
  85. package/dist/lang/ru.umd.prod.js +1 -1
  86. package/dist/lang/sk.umd.prod.js +1 -1
  87. package/dist/lang/sl.umd.prod.js +1 -1
  88. package/dist/lang/sm.umd.prod.js +6 -0
  89. package/dist/lang/sr-CYR.umd.prod.js +1 -1
  90. package/dist/lang/sr.umd.prod.js +1 -1
  91. package/dist/lang/sv.umd.prod.js +1 -1
  92. package/dist/lang/ta.umd.prod.js +1 -1
  93. package/dist/lang/th.umd.prod.js +1 -1
  94. package/dist/lang/tr.umd.prod.js +1 -1
  95. package/dist/lang/ug.umd.prod.js +1 -1
  96. package/dist/lang/uk.umd.prod.js +1 -1
  97. package/dist/lang/vi.umd.prod.js +1 -1
  98. package/dist/lang/zh-CN.umd.prod.js +1 -1
  99. package/dist/lang/zh-TW.umd.prod.js +1 -1
  100. package/dist/quasar.cjs.prod.js +2 -2
  101. package/dist/quasar.css +5 -8
  102. package/dist/quasar.esm.prod.js +2 -2
  103. package/dist/quasar.prod.css +1 -1
  104. package/dist/quasar.rtl.css +5 -9
  105. package/dist/quasar.rtl.prod.css +1 -1
  106. package/dist/quasar.sass +6 -8
  107. package/dist/quasar.umd.js +100 -66
  108. package/dist/quasar.umd.prod.js +2 -2
  109. package/dist/types/index.d.ts +6 -1
  110. package/dist/vetur/quasar-attributes.json +4 -0
  111. package/dist/vetur/quasar-tags.json +2 -1
  112. package/dist/web-types/web-types.json +12 -2
  113. package/icon-set/material-symbols-outlined.js +87 -87
  114. package/icon-set/material-symbols-outlined.mjs +87 -87
  115. package/icon-set/svg-material-symbols-outlined.js +151 -151
  116. package/icon-set/svg-material-symbols-outlined.mjs +151 -151
  117. package/lang/ca.js +31 -31
  118. package/lang/ca.mjs +31 -31
  119. package/lang/index.json +4 -0
  120. package/lang/ko-KR.js +21 -21
  121. package/lang/ko-KR.mjs +21 -21
  122. package/lang/sm.js +96 -0
  123. package/lang/sm.mjs +91 -0
  124. package/package.json +13 -12
  125. package/src/components/badge/QBadge.js +2 -2
  126. package/src/components/checkbox/use-checkbox.js +8 -7
  127. package/src/components/dialog/QDialog.js +3 -1
  128. package/src/components/dialog/QDialog.json +7 -0
  129. package/src/components/file/QFile.js +6 -1
  130. package/src/components/icon/QIcon.sass +3 -2
  131. package/src/components/img/QImg.sass +1 -0
  132. package/src/components/input/QInput.js +1 -1
  133. package/src/components/menu/__tests__/QMenu.spec.js +23 -23
  134. package/src/components/pagination/QPagination.json +1 -1
  135. package/src/components/radio/QRadio.js +2 -2
  136. package/src/components/select/QSelect.js +27 -15
  137. package/src/components/select/__tests__/QSelect.spec.js +427 -451
  138. package/src/components/table/QTable.js +0 -1
  139. package/src/components/table/QTable.sass +1 -1
  140. package/src/components/tabs/QTabs.sass +0 -6
  141. package/src/components/uploader/uploader-core.js +1 -0
  142. package/src/components/virtual-scroll/use-virtual-scroll.js +6 -1
  143. package/src/composables/private/__tests__/use-anchor.spec.js +6 -6
  144. package/src/composables/private/__tests__/use-field.spec.js +7 -7
  145. package/src/composables/private/__tests__/use-model-toggle.spec.js +18 -17
  146. package/src/composables/private/__tests__/use-transition.spec.js +5 -5
  147. package/src/composables/private/__tests__/use-validate.spec.js +4 -4
  148. package/src/composables/private/use-anchor.js +1 -1
  149. package/src/composables/private/use-field.js +1 -1
  150. package/src/composables/private/use-key-composition.js +16 -13
  151. package/src/directives/Ripple.js +5 -9
  152. package/src/utils/date.js +1 -1
  153. package/src/utils/private/global-dialog.js +22 -10
  154. package/src/components/select/__tests__/WrapperOne.vue +0 -28
@@ -1,7 +1,23 @@
1
1
  /* eslint-disable no-unused-expressions */
2
2
  import { mount } from '@cypress/vue'
3
- import { ref, h } from 'vue'
4
- import WrapperOne from './WrapperOne.vue'
3
+ import { h, ref } from 'vue'
4
+ import { vModelAdapter } from '../../../../test/cypress/helpers/v-model-adapter.js'
5
+ import QSelect from '../QSelect.js'
6
+
7
+ function getHostElement (extendedSelector = '') {
8
+ return cy.get(`.q-select ${ extendedSelector }`)
9
+ }
10
+
11
+ function mountQSelect (options = {}) {
12
+ if (!options.props?.modelValue) {
13
+ options.props = {
14
+ modelValue: null,
15
+ ...options.props ?? {}
16
+ }
17
+ }
18
+
19
+ return mount(QSelect, options)
20
+ }
5
21
 
6
22
  // QSelect does not set the `data-cy` attribute on the root element, but on the `.q-field__native` element
7
23
  // This means we cannot use data-cy everywhere, but instead use a custom class `select-root` for this purpose
@@ -49,12 +65,12 @@ describe('QSelect API', () => {
49
65
  describe('(prop): dropdown-icon', () => {
50
66
  it('should use the dropdown-icon supplied', () => {
51
67
  const icon = 'map'
52
- mount(WrapperOne, {
53
- attrs: {
68
+ mountQSelect({
69
+ props: {
54
70
  dropdownIcon: icon
55
71
  }
56
72
  })
57
- cy.get('.select-root')
73
+ getHostElement()
58
74
  .get(`div:contains(${ icon })`)
59
75
  .should('exist')
60
76
  })
@@ -62,21 +78,27 @@ describe('QSelect API', () => {
62
78
 
63
79
  describe('(prop): use-input', () => {
64
80
  it('should render an input inside the select', () => {
65
- mount(WrapperOne, {
66
- attrs: {
81
+ mountQSelect({
82
+ props: {
67
83
  useInput: true
68
84
  }
69
85
  })
70
- cy.get('.select-root')
86
+ getHostElement()
71
87
  .get('input')
72
88
  .should('exist')
73
89
  })
74
90
 
75
- it('should not render an input by default', () => {
76
- mount(WrapperOne)
77
- cy.get('.select-root')
91
+ it('should render an input, but it shouldn\'t be visible', () => {
92
+ mountQSelect()
93
+
94
+ getHostElement()
78
95
  .get('input')
79
- .should('not.exist')
96
+ .should('not.be.visible')
97
+ })
98
+
99
+ it.skip('should not render an input by default', () => {
100
+ // Native input is now always rendered, due to having a target for autocomplete
101
+ // Refer to commit: https://github.com/quasarframework/quasar/commit/21a3af0dfe01bac0da617737562b599edee397a2
80
102
  })
81
103
  })
82
104
 
@@ -84,13 +106,13 @@ describe('QSelect API', () => {
84
106
  it('should use an input-debounce of 500ms by default', () => {
85
107
  const fn = cy.stub()
86
108
  const text = 'Hello there'
87
- mount(WrapperOne, {
88
- attrs: {
109
+ mountQSelect({
110
+ props: {
89
111
  useInput: true,
90
112
  onFilter: fn
91
113
  }
92
114
  })
93
- cy.get('.select-root')
115
+ getHostElement()
94
116
  .get('input')
95
117
  .type(text)
96
118
  .then(() => {
@@ -105,14 +127,14 @@ describe('QSelect API', () => {
105
127
  it('should use a custom input-debounce', () => {
106
128
  const fn = cy.stub()
107
129
  const text = 'Hello there'
108
- mount(WrapperOne, {
109
- attrs: {
130
+ mountQSelect({
131
+ props: {
110
132
  useInput: true,
111
133
  onFilter: fn,
112
134
  inputDebounce: 800
113
135
  }
114
136
  })
115
- cy.get('.select-root')
137
+ getHostElement()
116
138
  .get('input')
117
139
  .type(text)
118
140
  .wait(500)
@@ -130,19 +152,19 @@ describe('QSelect API', () => {
130
152
  describe('Category: content|behavior', () => {
131
153
  describe('(prop): hide-dropdown-icon', () => {
132
154
  it('should show the dropdown-icon when this property is not supplied', () => {
133
- mount(WrapperOne)
134
- cy.get('.select-root')
155
+ mountQSelect()
156
+ getHostElement()
135
157
  .get('.q-icon')
136
158
  .should('exist')
137
159
  })
138
160
 
139
161
  it('should hide the dropdown-icon when this property is true', () => {
140
- mount(WrapperOne, {
141
- attrs: {
162
+ mountQSelect({
163
+ props: {
142
164
  hideDropdownIcon: true
143
165
  }
144
166
  })
145
- cy.get('.select-root')
167
+ getHostElement()
146
168
  .get('.q-icon')
147
169
  .should('not.exist')
148
170
  })
@@ -152,21 +174,21 @@ describe('QSelect API', () => {
152
174
  describe('Category: general', () => {
153
175
  describe('(prop): tabindex', () => {
154
176
  it('should have a default tabindex of 0', () => {
155
- mount(WrapperOne)
156
- cy.get('.select-root [tabindex="0"]')
177
+ mountQSelect()
178
+ getHostElement('[tabindex="0"]')
157
179
  .should('exist')
158
180
  })
159
181
 
160
182
  it('should set the tabindex to the supplied value', () => {
161
183
  const tabindex = 2
162
- mount(WrapperOne, {
163
- attrs: {
184
+ mountQSelect({
185
+ props: {
164
186
  tabindex
165
187
  }
166
188
  })
167
- cy.get(`.select-root [tabindex="${ tabindex }"]`)
189
+ getHostElement(`[tabindex="${ tabindex }"]`)
168
190
  .should('exist')
169
- cy.get('.select-root [tabindex="0"]')
191
+ getHostElement('[tabindex="0"]')
170
192
  .should('not.exist')
171
193
  })
172
194
  })
@@ -176,13 +198,13 @@ describe('QSelect API', () => {
176
198
  describe('(prop): model-value', () => {
177
199
  it('should have the option selected passed in the model-value', () => {
178
200
  const modelValue = 'Option 1'
179
- mount(WrapperOne, {
180
- attrs: {
201
+ mountQSelect({
202
+ props: {
181
203
  modelValue,
182
204
  options: [ 'Option 1', 'Option 2', 'Option 3' ]
183
205
  }
184
206
  })
185
- cy.get('.select-root')
207
+ getHostElement()
186
208
  .should('include.text', modelValue)
187
209
  })
188
210
  })
@@ -190,14 +212,14 @@ describe('QSelect API', () => {
190
212
  describe('(prop): emit-value', () => {
191
213
  it('should emit the value under the value key, if options are objects', () => {
192
214
  const fn = cy.stub()
193
- mount(WrapperOne, {
194
- attrs: {
215
+ mountQSelect({
216
+ props: {
195
217
  emitValue: true,
196
218
  'onUpdate:modelValue': fn,
197
219
  options: [ { label: 'Option 1', value: 1 }, { label: 'Option 2', value: 2 } ]
198
220
  }
199
221
  })
200
- cy.get('.select-root')
222
+ getHostElement()
201
223
  .click()
202
224
  cy.get('.q-menu')
203
225
  .contains('Option 1')
@@ -210,13 +232,13 @@ describe('QSelect API', () => {
210
232
  it('should emit the whole object by default if options are objects', () => {
211
233
  const fn = cy.stub()
212
234
  const options = [ { label: 'Option 1', value: 1 }, { label: 'Option 2', value: 2 } ]
213
- mount(WrapperOne, {
214
- attrs: {
235
+ mountQSelect({
236
+ props: {
215
237
  'onUpdate:modelValue': fn,
216
238
  options
217
239
  }
218
240
  })
219
- cy.get('.select-root')
241
+ getHostElement()
220
242
  .click()
221
243
  cy.get('.q-menu')
222
244
  .contains('Option 1')
@@ -233,58 +255,60 @@ describe('QSelect API', () => {
233
255
  it('should select only one option by default', () => {
234
256
  const options = [ 'Option 1', 'Option 2' ]
235
257
  const model = ref(null)
236
- mount(WrapperOne, {
237
- attrs: {
238
- modelValue: model,
239
- 'onUpdate:modelValue': (val) => {
240
- model.value = val
241
- },
258
+ mountQSelect({
259
+ props: {
260
+ ...vModelAdapter(model),
242
261
  options
243
262
  }
244
263
  })
245
- cy.get('.select-root')
246
- .click()
247
- cy.get('.q-menu')
248
- .contains('Option 1')
249
- .click()
250
- .then(() => {
251
- expect(model.value).to.equal(options[ 0 ])
252
- })
253
- cy.get('.q-menu')
254
- .contains('Option 2')
255
- .click()
256
- .then(() => {
257
- expect(model.value).to.equal(options[ 1 ])
258
- })
264
+
265
+ getHostElement().click()
266
+ cy.withinSelectMenu(() => {
267
+ cy.contains('Option 1')
268
+ .click()
269
+ .then(() => {
270
+ expect(model.value).to.equal(options[ 0 ])
271
+ })
272
+ })
273
+
274
+ getHostElement().click()
275
+ cy.withinSelectMenu(() => {
276
+ cy.contains('Option 2')
277
+ .click()
278
+ .then(() => {
279
+ expect(model.value).to.equal(options[ 1 ])
280
+ })
281
+ })
259
282
  })
260
283
 
261
284
  it('should select multiple options if multiple is true', () => {
262
285
  const options = [ 'Option 1', 'Option 2' ]
263
286
  const model = ref([])
264
- mount(WrapperOne, {
265
- attrs: {
287
+ mountQSelect({
288
+ props: {
289
+ ...vModelAdapter(model),
266
290
  multiple: true,
267
- modelValue: model,
268
- 'onUpdate:modelValue': (val) => {
269
- model.value = val
270
- },
271
291
  options
272
292
  }
273
293
  })
274
- cy.get('.select-root')
275
- .click()
276
- cy.get('.q-menu')
277
- .contains('Option 1')
278
- .click()
279
- .then(() => {
280
- expect(model.value).to.eql([ options[ 0 ] ])
281
- })
282
- cy.get('.q-menu')
283
- .contains('Option 2')
284
- .click()
285
- .then(() => {
286
- expect(model.value).to.eql(options)
287
- })
294
+
295
+ getHostElement().click()
296
+ cy.withinSelectMenu({
297
+ persistent: true,
298
+ fn: () => {
299
+ cy.contains('Option 1')
300
+ .click()
301
+ .then(() => {
302
+ expect(model.value).to.eql([ options[ 0 ] ])
303
+ })
304
+
305
+ cy.contains('Option 2')
306
+ .click()
307
+ .then(() => {
308
+ expect(model.value).to.eql(options)
309
+ })
310
+ }
311
+ })
288
312
  })
289
313
  })
290
314
  })
@@ -293,12 +317,12 @@ describe('QSelect API', () => {
293
317
  describe('(prop): options', () => {
294
318
  it('should show each option when opening the dropdown', () => {
295
319
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
296
- mount(WrapperOne, {
297
- attrs: {
320
+ mountQSelect({
321
+ props: {
298
322
  options
299
323
  }
300
324
  })
301
- cy.get('.select-root')
325
+ getHostElement()
302
326
  .click()
303
327
  cy.get('.q-menu')
304
328
  .children()
@@ -313,17 +337,14 @@ describe('QSelect API', () => {
313
337
  it('should use the value key as option-value by default', () => {
314
338
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
315
339
  const model = ref(null)
316
- mount(WrapperOne, {
317
- attrs: {
340
+ mountQSelect({
341
+ props: {
342
+ ...vModelAdapter(model),
318
343
  options,
319
- emitValue: true,
320
- modelValue: model,
321
- 'onUpdate:modelValue': (val) => {
322
- model.value = val
323
- }
344
+ emitValue: true
324
345
  }
325
346
  })
326
- cy.get('.select-root')
347
+ getHostElement()
327
348
  .click()
328
349
  cy.get('.q-menu')
329
350
  .contains(options[ 0 ].label)
@@ -336,18 +357,15 @@ describe('QSelect API', () => {
336
357
  it('should use a custom key supplied by option-value', () => {
337
358
  const options = [ { label: 'Option one', test: 1 }, { label: 'Option two', test: 2 } ]
338
359
  const model = ref(null)
339
- mount(WrapperOne, {
340
- attrs: {
360
+ mountQSelect({
361
+ props: {
362
+ ...vModelAdapter(model),
341
363
  options,
342
364
  emitValue: true,
343
- optionValue: 'test',
344
- modelValue: model,
345
- 'onUpdate:modelValue': (val) => {
346
- model.value = val
347
- }
365
+ optionValue: 'test'
348
366
  }
349
367
  })
350
- cy.get('.select-root')
368
+ getHostElement()
351
369
  .click()
352
370
  cy.get('.q-menu')
353
371
  .contains(options[ 0 ].label)
@@ -360,18 +378,15 @@ describe('QSelect API', () => {
360
378
  it('should accept a function as option-value', () => {
361
379
  const options = [ { label: 'Option one', test: 1 }, { label: 'Option two', test: 2 } ]
362
380
  const model = ref(null)
363
- mount(WrapperOne, {
364
- attrs: {
381
+ mountQSelect({
382
+ props: {
383
+ ...vModelAdapter(model),
365
384
  options,
366
385
  emitValue: true,
367
- optionValue: (val) => val.test,
368
- modelValue: model,
369
- 'onUpdate:modelValue': (val) => {
370
- model.value = val
371
- }
386
+ optionValue: (val) => val.test
372
387
  }
373
388
  })
374
- cy.get('.select-root')
389
+ getHostElement()
375
390
  .click()
376
391
  cy.get('.q-menu')
377
392
  .contains(options[ 0 ].label)
@@ -385,12 +400,12 @@ describe('QSelect API', () => {
385
400
  describe('(prop): option-label', () => {
386
401
  it('should use the "label" key by default as option-label', () => {
387
402
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
388
- mount(WrapperOne, {
389
- attrs: {
403
+ mountQSelect({
404
+ props: {
390
405
  options
391
406
  }
392
407
  })
393
- cy.get('.select-root')
408
+ getHostElement()
394
409
  .click()
395
410
  cy.get('.q-menu')
396
411
  .children()
@@ -400,13 +415,13 @@ describe('QSelect API', () => {
400
415
 
401
416
  it('should use the key supplied by option-label', () => {
402
417
  const options = [ { test: 'Option one', value: 1 }, { test: 'Option two', value: 2 } ]
403
- mount(WrapperOne, {
404
- attrs: {
418
+ mountQSelect({
419
+ props: {
405
420
  options,
406
421
  optionLabel: 'test'
407
422
  }
408
423
  })
409
- cy.get('.select-root')
424
+ getHostElement()
410
425
  .click()
411
426
  cy.get('.q-menu')
412
427
  .children()
@@ -416,13 +431,13 @@ describe('QSelect API', () => {
416
431
 
417
432
  it('should accept a function as option-label', () => {
418
433
  const options = [ { test: 'Option one', value: 1 }, { test: 'Option two', value: 2 } ]
419
- mount(WrapperOne, {
420
- attrs: {
434
+ mountQSelect({
435
+ props: {
421
436
  options,
422
437
  optionLabel: (item) => (item === null ? 'Null' : item.test)
423
438
  }
424
439
  })
425
- cy.get('.select-root')
440
+ getHostElement()
426
441
  .click()
427
442
  cy.get('.q-menu')
428
443
  .children()
@@ -433,12 +448,12 @@ describe('QSelect API', () => {
433
448
  describe('(prop): option-disable', () => {
434
449
  it('should use the "disable" key by default as option-disable', () => {
435
450
  const options = [ { label: 'Option one', value: 1, disable: true }, { label: 'Option two', value: 2, disable: true } ]
436
- mount(WrapperOne, {
437
- attrs: {
451
+ mountQSelect({
452
+ props: {
438
453
  options
439
454
  }
440
455
  })
441
- cy.get('.select-root')
456
+ getHostElement()
442
457
  .click()
443
458
  cy.get('.q-menu')
444
459
  .get('[role="option"][aria-disabled="true"]')
@@ -447,13 +462,13 @@ describe('QSelect API', () => {
447
462
 
448
463
  it('should use the key supplied by option-disable', () => {
449
464
  const options = [ { label: 'Option one', value: 1, test: true }, { label: 'Option two', value: 2, disable: true } ]
450
- mount(WrapperOne, {
451
- attrs: {
465
+ mountQSelect({
466
+ props: {
452
467
  options,
453
468
  optionDisable: 'test'
454
469
  }
455
470
  })
456
- cy.get('.select-root')
471
+ getHostElement()
457
472
  .click()
458
473
  cy.get('.q-menu')
459
474
  .get('[role="option"][aria-disabled="true"]')
@@ -463,13 +478,13 @@ describe('QSelect API', () => {
463
478
 
464
479
  it('should accept a function as option-disable', () => {
465
480
  const options = [ { label: 'Option one', value: 1, test: true }, { label: 'Option two', value: 2, disable: true } ]
466
- mount(WrapperOne, {
467
- attrs: {
481
+ mountQSelect({
482
+ props: {
468
483
  options,
469
484
  optionDisable: (item) => (item === null ? true : item.test)
470
485
  }
471
486
  })
472
- cy.get('.select-root')
487
+ getHostElement()
473
488
  .click()
474
489
  cy.get('.q-menu')
475
490
  .get('[role="option"][aria-disabled="true"]')
@@ -481,13 +496,13 @@ describe('QSelect API', () => {
481
496
  describe('(prop): options-dense', () => {
482
497
  it('should show options list dense', () => {
483
498
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
484
- mount(WrapperOne, {
485
- attrs: {
499
+ mountQSelect({
500
+ props: {
486
501
  options,
487
502
  optionsDense: true
488
503
  }
489
504
  })
490
- cy.get('.select-root')
505
+ getHostElement()
491
506
  .click()
492
507
  cy.get('.q-menu')
493
508
  .get('.q-item')
@@ -498,13 +513,13 @@ describe('QSelect API', () => {
498
513
  describe('(prop): options-dark', () => {
499
514
  it('should show options list in dark mode', () => {
500
515
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
501
- mount(WrapperOne, {
502
- attrs: {
516
+ mountQSelect({
517
+ props: {
503
518
  options,
504
519
  optionsDark: true
505
520
  }
506
521
  })
507
- cy.get('.select-root')
522
+ getHostElement()
508
523
  .click()
509
524
  cy.get('.q-menu')
510
525
  .get('.q-item')
@@ -515,14 +530,14 @@ describe('QSelect API', () => {
515
530
  describe('(prop): options-selected-class', () => {
516
531
  it('should have text-{color} applied as selected by default', () => {
517
532
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
518
- mount(WrapperOne, {
519
- attrs: {
533
+ mountQSelect({
534
+ props: {
520
535
  options,
521
536
  modelValue: 'Option 1',
522
537
  color: 'orange'
523
538
  }
524
539
  })
525
- cy.get('.select-root')
540
+ getHostElement()
526
541
  .click()
527
542
  cy.get('.q-menu')
528
543
  .contains('[role="option"]', options[ 0 ])
@@ -531,15 +546,15 @@ describe('QSelect API', () => {
531
546
 
532
547
  it('should not have default active class when passed option is empty', () => {
533
548
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
534
- mount(WrapperOne, {
535
- attrs: {
549
+ mountQSelect({
550
+ props: {
536
551
  options,
537
552
  modelValue: 'Option 1',
538
553
  optionsSelectedClass: '',
539
554
  color: 'orange'
540
555
  }
541
556
  })
542
- cy.get('.select-root')
557
+ getHostElement()
543
558
  .click()
544
559
  cy.get('.q-menu')
545
560
  .contains('[role="option"]', options[ 0 ])
@@ -548,15 +563,15 @@ describe('QSelect API', () => {
548
563
 
549
564
  it('should have class name supplied by options-selected-class on active item', () => {
550
565
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
551
- mount(WrapperOne, {
552
- attrs: {
566
+ mountQSelect({
567
+ props: {
553
568
  options,
554
569
  modelValue: 'Option 1',
555
570
  optionsSelectedClass: 'test-class',
556
571
  color: 'orange'
557
572
  }
558
573
  })
559
- cy.get('.select-root')
574
+ getHostElement()
560
575
  .click()
561
576
  cy.get('.q-menu')
562
577
  .contains('[role="option"]', options[ 0 ])
@@ -572,12 +587,12 @@ describe('QSelect API', () => {
572
587
  describe('(prop): options-html', () => {
573
588
  it('should not render options with html by default', () => {
574
589
  const options = [ '<b style="color: red">Option 1</b>', 'Option 2' ]
575
- mount(WrapperOne, {
576
- attrs: {
590
+ mountQSelect({
591
+ props: {
577
592
  options
578
593
  }
579
594
  })
580
- cy.get('.select-root')
595
+ getHostElement()
581
596
  .click()
582
597
  cy.get('.q-menu')
583
598
  .contains('Option 1')
@@ -587,13 +602,13 @@ describe('QSelect API', () => {
587
602
 
588
603
  it('should render options with html when options-html is true', () => {
589
604
  const options = [ '<b style="color: red">Option 1</b>', 'Option 2' ]
590
- mount(WrapperOne, {
591
- attrs: {
605
+ mountQSelect({
606
+ props: {
592
607
  options,
593
608
  optionsHtml: true
594
609
  }
595
610
  })
596
- cy.get('.select-root')
611
+ getHostElement()
597
612
  .click()
598
613
  cy.get('.q-menu')
599
614
  .contains('Option 1')
@@ -605,27 +620,27 @@ describe('QSelect API', () => {
605
620
  describe('(prop): options-cover', () => {
606
621
  it('should make the popup menu cover the select', (done) => {
607
622
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
608
- mount(WrapperOne, {
609
- attrs: {
623
+ mountQSelect({
624
+ props: {
610
625
  options,
611
626
  optionsCover: true
612
627
  }
613
628
  })
614
- cy.get('.select-root')
629
+ getHostElement()
615
630
  .click()
616
631
  .isNotActionable(done)
617
632
  })
618
633
 
619
634
  it('should not make the popup menu cover the select when use-input is used', () => {
620
635
  const options = [ 'Option 1', 'Option 2', 'Option 3', 'Option 4' ]
621
- mount(WrapperOne, {
622
- attrs: {
636
+ mountQSelect({
637
+ props: {
623
638
  options,
624
639
  optionsCover: true,
625
640
  useInput: true
626
641
  }
627
642
  })
628
- cy.get('.select-root')
643
+ getHostElement()
629
644
  .click()
630
645
  .click({ timeout: 100 })
631
646
  })
@@ -634,14 +649,14 @@ describe('QSelect API', () => {
634
649
  describe('(prop): menu-shrink', () => {
635
650
  it('should shrink the menu', () => {
636
651
  const options = [ '1', '2', '3', '4' ]
637
- mount(WrapperOne, {
638
- attrs: {
652
+ mountQSelect({
653
+ props: {
639
654
  options,
640
655
  menuShrink: true
641
656
  }
642
657
  })
643
658
  let selectWidth = 0
644
- cy.get('.select-root')
659
+ getHostElement()
645
660
  .then(($el) => {
646
661
  selectWidth = $el[ 0 ].clientWidth
647
662
  })
@@ -656,26 +671,26 @@ describe('QSelect API', () => {
656
671
  describe('(prop): map-options', () => {
657
672
  it('should display the label of the selected value instead of the value itself', () => {
658
673
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
659
- mount(WrapperOne, {
660
- attrs: {
674
+ mountQSelect({
675
+ props: {
661
676
  options,
662
677
  modelValue: 1,
663
678
  mapOptions: true
664
679
  }
665
680
  })
666
- cy.get('.select-root')
681
+ getHostElement()
667
682
  .contains(options[ 0 ].label)
668
683
  })
669
684
 
670
685
  it('should display the selected value as string by default', () => {
671
686
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
672
- mount(WrapperOne, {
673
- attrs: {
687
+ mountQSelect({
688
+ props: {
674
689
  options,
675
690
  modelValue: 1
676
691
  }
677
692
  })
678
- cy.get('.select-root')
693
+ getHostElement()
679
694
  .contains(options[ 0 ].value)
680
695
  })
681
696
  })
@@ -699,37 +714,37 @@ describe('QSelect API', () => {
699
714
  describe('(prop): display-value', () => {
700
715
  it('should override the default selection string', () => {
701
716
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
702
- mount(WrapperOne, {
703
- attrs: {
717
+ mountQSelect({
718
+ props: {
704
719
  options,
705
720
  modelValue: 1,
706
721
  displayValue: 'Test'
707
722
  }
708
723
  })
709
- cy.get('.select-root')
724
+ getHostElement()
710
725
  .should('not.contain', options[ 0 ].value)
711
726
  .should('contain', 'Test')
712
727
  })
713
728
 
714
729
  it('should not override the default selection string when using `use-chips`', () => {
715
730
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
716
- mount(WrapperOne, {
717
- attrs: {
731
+ mountQSelect({
732
+ props: {
718
733
  options,
719
734
  modelValue: 1,
720
735
  displayValue: 'Test',
721
736
  useChips: true
722
737
  }
723
738
  })
724
- cy.get('.select-root')
739
+ getHostElement()
725
740
  .should('contain', options[ 0 ].value)
726
741
  .should('not.contain', 'Test')
727
742
  })
728
743
 
729
744
  it('should not override the default selection string when using `selected` slot', () => {
730
745
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
731
- mount(WrapperOne, {
732
- attrs: {
746
+ mountQSelect({
747
+ props: {
733
748
  options,
734
749
  modelValue: 1,
735
750
  displayValue: 'Test'
@@ -738,7 +753,7 @@ describe('QSelect API', () => {
738
753
  selected: () => 'Hello there'
739
754
  }
740
755
  })
741
- cy.get('.select-root')
756
+ getHostElement()
742
757
  .should('not.contain', options[ 0 ].value)
743
758
  .should('not.contain', 'Test')
744
759
  .should('contain', 'Hello there')
@@ -748,14 +763,14 @@ describe('QSelect API', () => {
748
763
  describe('(prop): display-value-html', () => {
749
764
  it('should render the selected option as html', () => {
750
765
  const options = [ '<b style="color: red">Option 1</b>', 'Option 2' ]
751
- mount(WrapperOne, {
752
- attrs: {
766
+ mountQSelect({
767
+ props: {
753
768
  options,
754
769
  modelValue: options[ 0 ],
755
770
  displayValueHtml: true
756
771
  }
757
772
  })
758
- cy.get('.select-root')
773
+ getHostElement()
759
774
  .contains('Option 1')
760
775
  .should('have.color', 'red')
761
776
  .should('have.css', 'font-weight', '700')
@@ -764,8 +779,8 @@ describe('QSelect API', () => {
764
779
  it('should not render the selected option as html when using `selected` slot', () => {
765
780
  const html = '<b style="color: red">Option 1</b>'
766
781
  const options = [ 'Option 1', 'Option 2' ]
767
- mount(WrapperOne, {
768
- attrs: {
782
+ mountQSelect({
783
+ props: {
769
784
  options,
770
785
  modelValue: options[ 0 ],
771
786
  displayValueHtml: true
@@ -774,15 +789,15 @@ describe('QSelect API', () => {
774
789
  selected: () => html
775
790
  }
776
791
  })
777
- cy.get('.select-root')
792
+ getHostElement()
778
793
  .contains(html)
779
794
  })
780
795
 
781
796
  it('should not render the selected option as html when using `selected-item` slot', () => {
782
797
  const html = '<b style="color: red">Option 1</b>'
783
798
  const options = [ 'Option 1', 'Option 2' ]
784
- mount(WrapperOne, {
785
- attrs: {
799
+ mountQSelect({
800
+ props: {
786
801
  options,
787
802
  modelValue: options[ 0 ],
788
803
  displayValueHtml: true
@@ -791,7 +806,7 @@ describe('QSelect API', () => {
791
806
  'selected-item': () => html
792
807
  }
793
808
  })
794
- cy.get('.select-root')
809
+ getHostElement()
795
810
  .contains(html)
796
811
  })
797
812
  })
@@ -799,22 +814,22 @@ describe('QSelect API', () => {
799
814
  describe('(prop): hide-selected', () => {
800
815
  it('should not show the selected value', () => {
801
816
  const options = [ 'Option 1', 'Option 2' ]
802
- mount(WrapperOne, {
803
- attrs: {
817
+ mountQSelect({
818
+ props: {
804
819
  options,
805
820
  modelValue: options[ 0 ],
806
821
  hideSelected: true
807
822
  }
808
823
  })
809
- cy.get('.select-root')
824
+ getHostElement()
810
825
  .should('not.contain', options[ 0 ])
811
826
  })
812
827
 
813
828
  it('should set the value on the underlying input when using hide-selected', () => {
814
829
  // Todo: it its not really clear from the docs that you need to use `useInput` and `fillInput` together with this prop to achieve this
815
830
  const options = [ 'Option 1', 'Option 2' ]
816
- mount(WrapperOne, {
817
- attrs: {
831
+ mountQSelect({
832
+ props: {
818
833
  options,
819
834
  modelValue: options[ 0 ],
820
835
  hideSelected: true,
@@ -822,7 +837,7 @@ describe('QSelect API', () => {
822
837
  useInput: true
823
838
  }
824
839
  })
825
- cy.get('.select-root')
840
+ getHostElement()
826
841
  .get('input')
827
842
  .should('have.value', options[ 0 ])
828
843
  })
@@ -832,25 +847,22 @@ describe('QSelect API', () => {
832
847
  it('should allow a maximum number of selections', () => {
833
848
  const max = 3
834
849
  const options = [ '1', '2', '3', '4', '5' ]
835
- const modelValue = ref([])
836
- mount(WrapperOne, {
837
- attrs: {
850
+ const model = ref([])
851
+ mountQSelect({
852
+ props: {
853
+ ...vModelAdapter(model),
838
854
  options,
839
- modelValue,
840
855
  maxValues: max,
841
- 'onUpdate:modelValue': (val) => {
842
- modelValue.value = val
843
- },
844
856
  multiple: true
845
857
  }
846
858
  })
847
- cy.get('.select-root')
859
+ getHostElement()
848
860
  .click()
849
861
  cy.get('.q-menu')
850
862
  .get('[role="option"]')
851
863
  .click({ multiple: true })
852
864
  .then(() => {
853
- expect(modelValue.value.length).to.equal(max)
865
+ expect(model.value.length).to.equal(max)
854
866
  })
855
867
  })
856
868
  })
@@ -858,14 +870,14 @@ describe('QSelect API', () => {
858
870
  describe('(prop): use-chips', () => {
859
871
  it('should use QChips to show the selected value', () => {
860
872
  const options = [ 'Option 1', 'Option 2' ]
861
- mount(WrapperOne, {
862
- attrs: {
873
+ mountQSelect({
874
+ props: {
863
875
  options,
864
876
  modelValue: options[ 0 ],
865
877
  useChips: true
866
878
  }
867
879
  })
868
- cy.get('.select-root')
880
+ getHostElement()
869
881
  .get('.q-chip')
870
882
  .should('contain', options[ 0 ])
871
883
  })
@@ -876,13 +888,13 @@ describe('QSelect API', () => {
876
888
  describe('(prop): popup-content-class', () => {
877
889
  it('should apply the class to the popup element', () => {
878
890
  const className = 'test-class'
879
- mount(WrapperOne, {
880
- attrs: {
891
+ mountQSelect({
892
+ props: {
881
893
  options: [ '1', '2 ' ],
882
894
  popupContentClass: className
883
895
  }
884
896
  })
885
- cy.get('.select-root')
897
+ getHostElement()
886
898
  .click()
887
899
  cy.get('.q-menu')
888
900
  .should('have.class', className)
@@ -892,13 +904,13 @@ describe('QSelect API', () => {
892
904
  describe('(prop): popup-content-style', () => {
893
905
  it('should apply the style definitions to the popup element', () => {
894
906
  const style = 'background: red;'
895
- mount(WrapperOne, {
896
- attrs: {
907
+ mountQSelect({
908
+ props: {
897
909
  options: [ '1', '2 ' ],
898
910
  popupContentStyle: style
899
911
  }
900
912
  })
901
- cy.get('.select-root')
913
+ getHostElement()
902
914
  .click()
903
915
  cy.get('.q-menu')
904
916
  .should('have.backgroundColor', 'red')
@@ -908,13 +920,13 @@ describe('QSelect API', () => {
908
920
  describe('(prop): input-class', () => {
909
921
  it('should apply a class to the input element when using `useInput`', () => {
910
922
  const className = 'test-class'
911
- mount(WrapperOne, {
912
- attrs: {
923
+ mountQSelect({
924
+ props: {
913
925
  useInput: true,
914
926
  inputClass: className
915
927
  }
916
928
  })
917
- cy.get('.select-root')
929
+ getHostElement()
918
930
  .get('input')
919
931
  .should('have.class', className)
920
932
  })
@@ -923,13 +935,13 @@ describe('QSelect API', () => {
923
935
  describe('(prop): input-style', () => {
924
936
  it('should apply a style to the input element when using `useInput`', () => {
925
937
  const style = 'font-size: 30px'
926
- mount(WrapperOne, {
927
- attrs: {
938
+ mountQSelect({
939
+ props: {
928
940
  useInput: true,
929
941
  inputStyle: style
930
942
  }
931
943
  })
932
- cy.get('.select-root')
944
+ getHostElement()
933
945
  .get('input')
934
946
  .should('have.css', 'font-size', '30px')
935
947
  })
@@ -942,8 +954,8 @@ describe('QSelect API', () => {
942
954
  it('should display when something is selected', () => {
943
955
  const selectedString = 'Test slot selected'
944
956
  const options = [ 'Option 1', 'Option 2' ]
945
- mount(WrapperOne, {
946
- attrs: {
957
+ mountQSelect({
958
+ props: {
947
959
  options,
948
960
  modelValue: options[ 0 ]
949
961
  },
@@ -951,7 +963,7 @@ describe('QSelect API', () => {
951
963
  selected: () => selectedString
952
964
  }
953
965
  })
954
- cy.get('.select-root')
966
+ getHostElement()
955
967
  .should('contain', selectedString)
956
968
  })
957
969
  })
@@ -959,44 +971,44 @@ describe('QSelect API', () => {
959
971
  describe('(slot): loading', () => {
960
972
  it('should display when element is loading', () => {
961
973
  const loadingString = 'Test slot loading'
962
- mount(WrapperOne, {
963
- attrs: {
974
+ mountQSelect({
975
+ props: {
964
976
  loading: true
965
977
  },
966
978
  slots: {
967
979
  loading: () => loadingString
968
980
  }
969
981
  })
970
- cy.get('.select-root')
982
+ getHostElement()
971
983
  .should('contain', loadingString)
972
984
  })
973
985
 
974
986
  it('should not display when element is loading', () => {
975
987
  const loadingString = 'Test slot loading'
976
- mount(WrapperOne, {
977
- attrs: {
988
+ mountQSelect({
989
+ props: {
978
990
  loading: false
979
991
  },
980
992
  slots: {
981
993
  loading: () => loadingString
982
994
  }
983
995
  })
984
- cy.get('.select-root')
996
+ getHostElement()
985
997
  .should('not.contain', loadingString)
986
998
  })
987
999
  })
988
1000
 
989
1001
  describe('(slot): before-options', () => {
990
1002
  it('should display the slot content before the options', () => {
991
- mount(WrapperOne, {
992
- attrs: {
1003
+ mountQSelect({
1004
+ props: {
993
1005
  options: [ '1', '2', '3' ]
994
1006
  },
995
1007
  slots: {
996
1008
  'before-options': () => h('div', { class: 'dummyClass' }, 'Hello')
997
1009
  }
998
1010
  })
999
- cy.get('.select-root')
1011
+ getHostElement()
1000
1012
  .click()
1001
1013
  cy.get('.q-menu')
1002
1014
  .children().first()
@@ -1006,15 +1018,15 @@ describe('QSelect API', () => {
1006
1018
 
1007
1019
  describe('(slot): after-options', () => {
1008
1020
  it('should display the slot content after the options', () => {
1009
- mount(WrapperOne, {
1010
- attrs: {
1021
+ mountQSelect({
1022
+ props: {
1011
1023
  options: [ '1', '2', '3' ]
1012
1024
  },
1013
1025
  slots: {
1014
1026
  'after-options': () => h('div', { class: 'dummyClass' }, 'Hello')
1015
1027
  }
1016
1028
  })
1017
- cy.get('.select-root')
1029
+ getHostElement()
1018
1030
  .click()
1019
1031
  cy.get('.q-menu')
1020
1032
  .children().last()
@@ -1025,15 +1037,15 @@ describe('QSelect API', () => {
1025
1037
  describe('(slot): no-option', () => {
1026
1038
  it('should display the slot content when there are no options', () => {
1027
1039
  const compareString = 'No options :('
1028
- mount(WrapperOne, {
1029
- attrs: {
1040
+ mountQSelect({
1041
+ props: {
1030
1042
  options: [ ]
1031
1043
  },
1032
1044
  slots: {
1033
1045
  'no-option': () => compareString
1034
1046
  }
1035
1047
  })
1036
- cy.get('.select-root')
1048
+ getHostElement()
1037
1049
  .click()
1038
1050
  cy.get('.q-menu')
1039
1051
  .should('contain', compareString)
@@ -1041,8 +1053,8 @@ describe('QSelect API', () => {
1041
1053
 
1042
1054
  it('should pass the inputValue to the slot scope', () => {
1043
1055
  const compareString = 'No options :('
1044
- mount(WrapperOne, {
1045
- attrs: {
1056
+ mountQSelect({
1057
+ props: {
1046
1058
  options: [ ],
1047
1059
  useInput: true
1048
1060
  },
@@ -1050,7 +1062,7 @@ describe('QSelect API', () => {
1050
1062
  'no-option': (scope) => compareString + scope.inputValue
1051
1063
  }
1052
1064
  })
1053
- cy.get('.select-root')
1065
+ getHostElement()
1054
1066
  .click()
1055
1067
  .type('Hello')
1056
1068
  cy.get('.q-menu')
@@ -1059,15 +1071,15 @@ describe('QSelect API', () => {
1059
1071
 
1060
1072
  it('should not display the slot content when there are options', () => {
1061
1073
  const compareString = 'No options :('
1062
- mount(WrapperOne, {
1063
- attrs: {
1074
+ mountQSelect({
1075
+ props: {
1064
1076
  options: [ '1', '2', '3' ]
1065
1077
  },
1066
1078
  slots: {
1067
1079
  'no-option': () => compareString
1068
1080
  }
1069
1081
  })
1070
- cy.get('.select-root')
1082
+ getHostElement()
1071
1083
  .click()
1072
1084
  cy.get('.q-menu')
1073
1085
  .should('not.contain', compareString)
@@ -1077,8 +1089,8 @@ describe('QSelect API', () => {
1077
1089
  describe('(slot): selected-item', () => {
1078
1090
  it('should override the default selection slot', () => {
1079
1091
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
1080
- mount(WrapperOne, {
1081
- attrs: {
1092
+ mountQSelect({
1093
+ props: {
1082
1094
  options,
1083
1095
  modelValue: 1
1084
1096
  },
@@ -1086,15 +1098,15 @@ describe('QSelect API', () => {
1086
1098
  'selected-item': () => 'Test'
1087
1099
  }
1088
1100
  })
1089
- cy.get('.select-root')
1101
+ getHostElement()
1090
1102
  .should('not.contain', options[ 0 ].value)
1091
1103
  .should('contain', 'Test')
1092
1104
  })
1093
1105
 
1094
1106
  it('should pass the selected option index to the slot scope', () => {
1095
1107
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
1096
- mount(WrapperOne, {
1097
- attrs: {
1108
+ mountQSelect({
1109
+ props: {
1098
1110
  options,
1099
1111
  modelValue: 1
1100
1112
  },
@@ -1102,14 +1114,14 @@ describe('QSelect API', () => {
1102
1114
  'selected-item': (scope) => 'Test' + scope.index
1103
1115
  }
1104
1116
  })
1105
- cy.get('.select-root')
1117
+ getHostElement()
1106
1118
  .should('contain', 'Test0')
1107
1119
  })
1108
1120
 
1109
1121
  it('should pass the selected option value to the slot scope', () => {
1110
1122
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
1111
- mount(WrapperOne, {
1112
- attrs: {
1123
+ mountQSelect({
1124
+ props: {
1113
1125
  options,
1114
1126
  modelValue: 1
1115
1127
  },
@@ -1117,29 +1129,26 @@ describe('QSelect API', () => {
1117
1129
  'selected-item': (scope) => 'Test' + scope.opt
1118
1130
  }
1119
1131
  })
1120
- cy.get('.select-root')
1132
+ getHostElement()
1121
1133
  .should('contain', 'Test1')
1122
1134
  })
1123
1135
 
1124
1136
  it('should pass a removeAtIndex function to the slot scope', () => {
1125
1137
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
1126
1138
  const model = ref(1)
1127
- mount(WrapperOne, {
1128
- attrs: {
1129
- options,
1130
- modelValue: model,
1131
- 'onUpdate:modelValue': (val) => {
1132
- model.value = val
1133
- }
1139
+ mountQSelect({
1140
+ props: {
1141
+ ...vModelAdapter(model),
1142
+ options
1134
1143
  },
1135
1144
  slots: {
1136
1145
  'selected-item': (scope) => h('button', { class: 'remove', onClick: () => scope.removeAtIndex(scope.index) }, 'Remove')
1137
1146
  }
1138
1147
  })
1139
- cy.get('.select-root')
1148
+ getHostElement()
1140
1149
  .get('button.remove')
1141
1150
  .click()
1142
- cy.get('.select-root')
1151
+ getHostElement()
1143
1152
  .get('button.remove')
1144
1153
  .should('not.exist')
1145
1154
  })
@@ -1147,23 +1156,20 @@ describe('QSelect API', () => {
1147
1156
  it('should pass a toggleOption function to the slot scope', () => {
1148
1157
  const options = [ { label: 'Option one', value: 1 }, { label: 'Option two', value: 2 } ]
1149
1158
  const model = ref(1)
1150
- mount(WrapperOne, {
1151
- attrs: {
1152
- options,
1153
- modelValue: model,
1154
- 'onUpdate:modelValue': (val) => {
1155
- model.value = val
1156
- }
1159
+ mountQSelect({
1160
+ props: {
1161
+ ...vModelAdapter(model),
1162
+ options
1157
1163
  },
1158
1164
  slots: {
1159
1165
  'selected-item': (scope) => h('button', { class: 'toggle', onClick: () => scope.toggleOption(2) }, 'Toggle' + scope.opt)
1160
1166
  }
1161
1167
  })
1162
- cy.get('.select-root')
1168
+ getHostElement()
1163
1169
  .get('button.toggle')
1164
1170
  .should('contain', 'Toggle1')
1165
1171
  .click()
1166
- cy.get('.select-root')
1172
+ getHostElement()
1167
1173
  .get('button.toggle')
1168
1174
  .should('contain', 'Toggle2')
1169
1175
  })
@@ -1172,15 +1178,15 @@ describe('QSelect API', () => {
1172
1178
  describe('(slot): option', () => {
1173
1179
  it('should render a list of the provided slot as options', () => {
1174
1180
  const options = [ '1', '2', '3' ]
1175
- mount(WrapperOne, {
1176
- attrs: {
1181
+ mountQSelect({
1182
+ props: {
1177
1183
  options
1178
1184
  },
1179
1185
  slots: {
1180
1186
  option: (scope) => h('div', { class: 'custom-option' }, scope.opt)
1181
1187
  }
1182
1188
  })
1183
- cy.get('.select-root')
1189
+ getHostElement()
1184
1190
  .click()
1185
1191
  cy.get('.q-menu')
1186
1192
  .get('.custom-option')
@@ -1189,8 +1195,8 @@ describe('QSelect API', () => {
1189
1195
 
1190
1196
  it('should have a selected property in the scope', () => {
1191
1197
  const options = [ '1', '2', '3' ]
1192
- mount(WrapperOne, {
1193
- attrs: {
1198
+ mountQSelect({
1199
+ props: {
1194
1200
  modelValue: '1',
1195
1201
  options
1196
1202
  },
@@ -1198,7 +1204,7 @@ describe('QSelect API', () => {
1198
1204
  option: (scope) => h('div', { class: `custom-option-${ scope.selected }` }, scope.opt + scope.selected)
1199
1205
  }
1200
1206
  })
1201
- cy.get('.select-root')
1207
+ getHostElement()
1202
1208
  .click()
1203
1209
  cy.get('.q-menu')
1204
1210
  .get('.custom-option-true')
@@ -1212,8 +1218,8 @@ describe('QSelect API', () => {
1212
1218
  describe('(event): update:model-value', () => {
1213
1219
  it('should emit event when model value changes', () => {
1214
1220
  const fn = cy.stub()
1215
- mount(WrapperOne, {
1216
- attrs: {
1221
+ mountQSelect({
1222
+ props: {
1217
1223
  options: [ '1', '2', '3' ],
1218
1224
  modelValue: null,
1219
1225
  'onUpdate:modelValue': fn
@@ -1221,7 +1227,7 @@ describe('QSelect API', () => {
1221
1227
  })
1222
1228
 
1223
1229
  expect(fn).not.to.be.called
1224
- cy.get('.select-root')
1230
+ getHostElement()
1225
1231
  .click()
1226
1232
  cy.get('.q-menu')
1227
1233
  .get('[role="option"]')
@@ -1236,8 +1242,8 @@ describe('QSelect API', () => {
1236
1242
  describe('(event): input-value', () => {
1237
1243
  it('should emit event when text input changes', () => {
1238
1244
  const fn = cy.stub()
1239
- mount(WrapperOne, {
1240
- attrs: {
1245
+ mountQSelect({
1246
+ props: {
1241
1247
  modelValue: null,
1242
1248
  onInputValue: fn,
1243
1249
  useInput: true
@@ -1245,7 +1251,7 @@ describe('QSelect API', () => {
1245
1251
  })
1246
1252
 
1247
1253
  expect(fn).not.to.be.called
1248
- cy.get('.select-root')
1254
+ getHostElement()
1249
1255
  .get('input')
1250
1256
  .type('h')
1251
1257
  .then(() => {
@@ -1258,20 +1264,17 @@ describe('QSelect API', () => {
1258
1264
  it('should emit event when a selected item is removed from selection', () => {
1259
1265
  const fn = cy.stub()
1260
1266
  const model = ref([ '2', '3' ])
1261
- mount(WrapperOne, {
1262
- attrs: {
1267
+ mountQSelect({
1268
+ props: {
1269
+ ...vModelAdapter(model),
1263
1270
  onRemove: fn,
1264
1271
  multiple: true,
1265
- modelValue: model,
1266
- 'onUpdate:modelValue': (val) => {
1267
- model.value = val
1268
- },
1269
1272
  options: [ '1', '2', '3' ]
1270
1273
  }
1271
1274
  })
1272
1275
 
1273
1276
  expect(fn).not.to.be.called
1274
- cy.get('.select-root')
1277
+ getHostElement()
1275
1278
  .click()
1276
1279
  cy.get('.q-menu')
1277
1280
  .get('[role="option"]')
@@ -1295,20 +1298,17 @@ describe('QSelect API', () => {
1295
1298
  it('should emit event when an option is added to the selection', () => {
1296
1299
  const fn = cy.stub()
1297
1300
  const model = ref([ '2' ])
1298
- mount(WrapperOne, {
1299
- attrs: {
1301
+ mountQSelect({
1302
+ props: {
1303
+ ...vModelAdapter(model),
1300
1304
  onAdd: fn,
1301
1305
  multiple: true,
1302
- modelValue: model,
1303
- 'onUpdate:modelValue': (val) => {
1304
- model.value = val
1305
- },
1306
1306
  options: [ '1', '2', '3' ]
1307
1307
  }
1308
1308
  })
1309
1309
 
1310
1310
  expect(fn).not.to.be.called
1311
- cy.get('.select-root')
1311
+ getHostElement()
1312
1312
  .click()
1313
1313
  cy.get('.q-menu')
1314
1314
  .get('[role="option"]')
@@ -1325,21 +1325,18 @@ describe('QSelect API', () => {
1325
1325
  it('should emit event when something is typed into the input field and enter is pressed', () => {
1326
1326
  const fn = cy.stub()
1327
1327
  const model = ref([ '2' ])
1328
- mount(WrapperOne, {
1329
- attrs: {
1328
+ mountQSelect({
1329
+ props: {
1330
+ ...vModelAdapter(model),
1330
1331
  onNewValue: fn,
1331
1332
  multiple: true,
1332
1333
  useInput: true,
1333
- modelValue: model,
1334
- 'onUpdate:modelValue': (val) => {
1335
- model.value = val
1336
- },
1337
1334
  hideDropdownIcon: true
1338
1335
  }
1339
1336
  })
1340
1337
 
1341
1338
  expect(fn).not.to.be.called
1342
- cy.get('.select-root')
1339
+ getHostElement()
1343
1340
  .get('input')
1344
1341
  .type('100')
1345
1342
  .then(() => {
@@ -1353,22 +1350,19 @@ describe('QSelect API', () => {
1353
1350
 
1354
1351
  it('should add the value to the model when the doneFn is called', () => {
1355
1352
  const model = ref([ '2' ])
1356
- mount(WrapperOne, {
1357
- attrs: {
1353
+ mountQSelect({
1354
+ props: {
1355
+ ...vModelAdapter(model),
1358
1356
  onNewValue: (val, doneFn) => {
1359
1357
  doneFn(val)
1360
1358
  },
1361
1359
  multiple: true,
1362
1360
  useInput: true,
1363
- modelValue: model,
1364
- 'onUpdate:modelValue': (val) => {
1365
- model.value = val
1366
- },
1367
1361
  hideDropdownIcon: true
1368
1362
  }
1369
1363
  })
1370
1364
 
1371
- cy.get('.select-root')
1365
+ getHostElement()
1372
1366
  .get('input')
1373
1367
  .type('100')
1374
1368
  .type('{enter}')
@@ -1381,8 +1375,8 @@ describe('QSelect API', () => {
1381
1375
  describe('(event): filter', () => {
1382
1376
  it('should emit event when something is typed into the input field', () => {
1383
1377
  const fn = cy.stub()
1384
- mount(WrapperOne, {
1385
- attrs: {
1378
+ mountQSelect({
1379
+ props: {
1386
1380
  onFilter: fn,
1387
1381
  useInput: true,
1388
1382
  inputDebounce: 0
@@ -1390,7 +1384,7 @@ describe('QSelect API', () => {
1390
1384
  })
1391
1385
 
1392
1386
  expect(fn).not.to.be.called
1393
- cy.get('.select-root')
1387
+ getHostElement()
1394
1388
  .get('input')
1395
1389
  .type('h')
1396
1390
  .then(() => {
@@ -1403,8 +1397,8 @@ describe('QSelect API', () => {
1403
1397
  it('should emit event when the the filterFn has not called the doneFn yet and a new filter is requested', () => {
1404
1398
  const fn = cy.stub()
1405
1399
  const filterFn = cy.stub()
1406
- mount(WrapperOne, {
1407
- attrs: {
1400
+ mountQSelect({
1401
+ props: {
1408
1402
  onFilter: filterFn,
1409
1403
  onFilterAbort: fn,
1410
1404
  useInput: true,
@@ -1413,7 +1407,7 @@ describe('QSelect API', () => {
1413
1407
  })
1414
1408
 
1415
1409
  expect(fn).not.to.be.called
1416
- cy.get('.select-root')
1410
+ getHostElement()
1417
1411
  .get('input')
1418
1412
  .click()
1419
1413
  .then(() => {
@@ -1428,8 +1422,8 @@ describe('QSelect API', () => {
1428
1422
 
1429
1423
  it('should not emit event when the filter has called its doneFn', () => {
1430
1424
  const fn = cy.stub()
1431
- mount(WrapperOne, {
1432
- attrs: {
1425
+ mountQSelect({
1426
+ props: {
1433
1427
  onFilter: (val, doneFn) => {
1434
1428
  doneFn()
1435
1429
  },
@@ -1440,7 +1434,7 @@ describe('QSelect API', () => {
1440
1434
  })
1441
1435
 
1442
1436
  expect(fn).not.to.be.called
1443
- cy.get('.select-root')
1437
+ getHostElement()
1444
1438
  .get('input')
1445
1439
  .click()
1446
1440
  .then(() => {
@@ -1456,15 +1450,15 @@ describe('QSelect API', () => {
1456
1450
  describe('(event): popup-show', () => {
1457
1451
  it('should emit event when the options are shown', () => {
1458
1452
  const fn = cy.stub()
1459
- mount(WrapperOne, {
1460
- attrs: {
1453
+ mountQSelect({
1454
+ props: {
1461
1455
  onPopupShow: fn,
1462
1456
  options: [ '1', '2', '3' ]
1463
1457
  }
1464
1458
  })
1465
1459
 
1466
1460
  expect(fn).not.to.be.called
1467
- cy.get('.select-root')
1461
+ getHostElement()
1468
1462
  .click()
1469
1463
  .then(() => {
1470
1464
  expect(fn).to.be.called
@@ -1475,15 +1469,15 @@ describe('QSelect API', () => {
1475
1469
  describe('(event): popup-hide', () => {
1476
1470
  it('should emit event when the options are hidden', () => {
1477
1471
  const fn = cy.stub()
1478
- mount(WrapperOne, {
1479
- attrs: {
1472
+ mountQSelect({
1473
+ props: {
1480
1474
  onPopupHide: fn,
1481
1475
  options: [ '1', '2', '3' ]
1482
1476
  }
1483
1477
  })
1484
1478
 
1485
1479
  expect(fn).not.to.be.called
1486
- cy.get('.select-root')
1480
+ getHostElement()
1487
1481
  .click()
1488
1482
  .then(() => {
1489
1483
  expect(fn).not.to.be.called
@@ -1508,16 +1502,16 @@ describe('QSelect API', () => {
1508
1502
  describe('Methods', () => {
1509
1503
  describe('(method): focus', () => {
1510
1504
  it('should focus the component', () => {
1511
- mount(WrapperOne)
1505
+ mountQSelect()
1512
1506
 
1513
- cy.dataCy('select')
1507
+ getHostElement()
1514
1508
  .get('[tabindex="0"]')
1515
1509
  .should('not.have.focus')
1516
- cy.dataCy('select')
1510
+ getHostElement()
1517
1511
  .then(() => {
1518
- Cypress.vueWrapper.vm.compRef.focus()
1512
+ Cypress.vueWrapper.vm.focus()
1519
1513
  })
1520
- cy.dataCy('select')
1514
+ getHostElement()
1521
1515
  .get('[tabindex="0"]')
1522
1516
  .should('have.focus')
1523
1517
  })
@@ -1525,8 +1519,8 @@ describe('QSelect API', () => {
1525
1519
 
1526
1520
  describe('(method): showPopup', () => {
1527
1521
  it('should open the popup and focus the component', () => {
1528
- mount(WrapperOne, {
1529
- attrs: {
1522
+ mountQSelect({
1523
+ props: {
1530
1524
  options: [ '1', '2' ]
1531
1525
  }
1532
1526
  })
@@ -1534,11 +1528,11 @@ describe('QSelect API', () => {
1534
1528
  cy.get('.q-menu')
1535
1529
  .should('not.exist')
1536
1530
  .then(() => {
1537
- Cypress.vueWrapper.vm.compRef.showPopup()
1531
+ Cypress.vueWrapper.vm.showPopup()
1538
1532
  })
1539
1533
  cy.get('.q-menu')
1540
1534
  .should('be.visible')
1541
- cy.dataCy('select')
1535
+ getHostElement()
1542
1536
  .get('[tabindex="0"]')
1543
1537
  .should('have.focus')
1544
1538
  })
@@ -1546,18 +1540,18 @@ describe('QSelect API', () => {
1546
1540
 
1547
1541
  describe('(method): hidePopup', () => {
1548
1542
  it('should hide the popup', () => {
1549
- mount(WrapperOne, {
1550
- attrs: {
1543
+ mountQSelect({
1544
+ props: {
1551
1545
  options: [ '1', '2' ]
1552
1546
  }
1553
1547
  })
1554
1548
 
1555
- cy.get('.select-root')
1549
+ getHostElement()
1556
1550
  .click()
1557
1551
  cy.get('.q-menu')
1558
1552
  .should('be.visible')
1559
1553
  .then(() => {
1560
- Cypress.vueWrapper.vm.compRef.hidePopup()
1554
+ Cypress.vueWrapper.vm.hidePopup()
1561
1555
  })
1562
1556
  cy.get('.q-menu')
1563
1557
  .should('not.exist')
@@ -1568,19 +1562,16 @@ describe('QSelect API', () => {
1568
1562
  it('should remove a selected option at the correct index', () => {
1569
1563
  const options = [ '1', '2', '3', '4' ]
1570
1564
  const model = ref([ '1', '2', '4' ])
1571
- mount(WrapperOne, {
1572
- attrs: {
1573
- modelValue: model,
1574
- 'onUpdate:modelValue': (val) => {
1575
- model.value = val
1576
- },
1565
+ mountQSelect({
1566
+ props: {
1567
+ ...vModelAdapter(model),
1577
1568
  multiple: true,
1578
1569
  options
1579
1570
  }
1580
1571
  })
1581
1572
  .then(() => {
1582
1573
  expect(model.value.includes('4')).to.be.true
1583
- Cypress.vueWrapper.vm.compRef.removeAtIndex(2)
1574
+ Cypress.vueWrapper.vm.removeAtIndex(2)
1584
1575
  expect(model.value.includes('4')).to.be.false
1585
1576
  })
1586
1577
  })
@@ -1589,38 +1580,32 @@ describe('QSelect API', () => {
1589
1580
  describe('(method): add', () => {
1590
1581
  it('should add a selected option', () => {
1591
1582
  const model = ref([ '1', '2' ])
1592
- mount(WrapperOne, {
1593
- attrs: {
1594
- modelValue: model,
1595
- 'onUpdate:modelValue': (val) => {
1596
- model.value = val
1597
- },
1583
+ mountQSelect({
1584
+ props: {
1585
+ ...vModelAdapter(model),
1598
1586
  multiple: true
1599
1587
  }
1600
1588
  })
1601
1589
  .then(() => {
1602
1590
  expect(model.value.includes('100')).to.be.false
1603
- Cypress.vueWrapper.vm.compRef.add('100')
1591
+ Cypress.vueWrapper.vm.add('100')
1604
1592
  expect(model.value.includes('100')).to.be.true
1605
1593
  })
1606
1594
  })
1607
1595
 
1608
1596
  it('should not add a duplicate option when unique is true', () => {
1609
1597
  const model = ref([ '1', '2' ])
1610
- mount(WrapperOne, {
1611
- attrs: {
1612
- modelValue: model,
1613
- 'onUpdate:modelValue': (val) => {
1614
- model.value = val
1615
- },
1598
+ mountQSelect({
1599
+ props: {
1600
+ ...vModelAdapter(model),
1616
1601
  multiple: true
1617
1602
  }
1618
1603
  })
1619
1604
  .then(() => {
1620
1605
  expect(model.value.length).to.be.equal(2)
1621
- Cypress.vueWrapper.vm.compRef.add('2', true)
1606
+ Cypress.vueWrapper.vm.add('2', true)
1622
1607
  expect(model.value.length).to.be.equal(2)
1623
- Cypress.vueWrapper.vm.compRef.add('2')
1608
+ Cypress.vueWrapper.vm.add('2')
1624
1609
  expect(model.value.length).to.be.equal(3)
1625
1610
  })
1626
1611
  })
@@ -1629,24 +1614,21 @@ describe('QSelect API', () => {
1629
1614
  describe('(method): toggleOption', () => {
1630
1615
  it('should toggle an option', () => {
1631
1616
  const model = ref([ '1', '2' ])
1632
- mount(WrapperOne, {
1633
- attrs: {
1634
- modelValue: model,
1635
- 'onUpdate:modelValue': (val) => {
1636
- model.value = val
1637
- },
1617
+ mountQSelect({
1618
+ props: {
1619
+ ...vModelAdapter(model),
1638
1620
  multiple: true
1639
1621
  }
1640
1622
  })
1641
1623
  .then(() => {
1642
1624
  expect(model.value.length).to.be.equal(2)
1643
- Cypress.vueWrapper.vm.compRef.toggleOption('2')
1625
+ Cypress.vueWrapper.vm.toggleOption('2')
1644
1626
  expect(model.value.length).to.be.equal(1)
1645
1627
  })
1646
1628
  // When not using this wait this test will succeed on `open-ct` but fail on `run-ct`
1647
1629
  .wait(50)
1648
1630
  .then(() => {
1649
- Cypress.vueWrapper.vm.compRef.toggleOption('2')
1631
+ Cypress.vueWrapper.vm.toggleOption('2')
1650
1632
  expect(model.value.length).to.be.equal(2)
1651
1633
  })
1652
1634
  })
@@ -1655,25 +1637,22 @@ describe('QSelect API', () => {
1655
1637
  // should this be consistent? E.g. use `true` as argument when multiple is true by default but make sure it can be overridden.
1656
1638
  it('should close the menu and clear the filter', () => {
1657
1639
  const model = ref('1')
1658
- mount(WrapperOne, {
1659
- attrs: {
1660
- modelValue: model,
1661
- 'onUpdate:modelValue': (val) => {
1662
- model.value = val
1663
- },
1640
+ mountQSelect({
1641
+ props: {
1642
+ ...vModelAdapter(model),
1664
1643
  options: [ '1', '2' ],
1665
1644
  useInput: true
1666
1645
  }
1667
1646
  })
1668
1647
 
1669
- cy.get('.select-root')
1648
+ getHostElement()
1670
1649
  .click()
1671
1650
  .get('input')
1672
1651
  .type('h')
1673
1652
  cy.get('.q-menu')
1674
1653
  .should('be.visible')
1675
1654
  .then(() => {
1676
- Cypress.vueWrapper.vm.compRef.toggleOption('2')
1655
+ Cypress.vueWrapper.vm.toggleOption('2')
1677
1656
  })
1678
1657
  cy.get('.q-menu')
1679
1658
  .should('not.exist')
@@ -1683,25 +1662,22 @@ describe('QSelect API', () => {
1683
1662
 
1684
1663
  it('should not close the menu and clear the filter when keepOpen is true', () => {
1685
1664
  const model = ref('1')
1686
- mount(WrapperOne, {
1687
- attrs: {
1688
- modelValue: model,
1689
- 'onUpdate:modelValue': (val) => {
1690
- model.value = val
1691
- },
1665
+ mountQSelect({
1666
+ props: {
1667
+ ...vModelAdapter(model),
1692
1668
  options: [ '1', '2' ],
1693
1669
  useInput: true
1694
1670
  }
1695
1671
  })
1696
1672
 
1697
- cy.get('.select-root')
1673
+ getHostElement()
1698
1674
  .click()
1699
1675
  .get('input')
1700
1676
  .type('h')
1701
1677
  cy.get('.q-menu')
1702
1678
  .should('be.visible')
1703
1679
  .then(() => {
1704
- Cypress.vueWrapper.vm.compRef.toggleOption('2', true)
1680
+ Cypress.vueWrapper.vm.toggleOption('2', true)
1705
1681
  })
1706
1682
  cy.get('.q-menu')
1707
1683
  .should('be.visible')
@@ -1713,15 +1689,15 @@ describe('QSelect API', () => {
1713
1689
  describe('(method): setOptionIndex', () => {
1714
1690
  it('should set an option from the menu dropdown as focused', () => {
1715
1691
  const options = [ '1', '2', '3', '4' ]
1716
- mount(WrapperOne, {
1717
- attrs: {
1692
+ mountQSelect({
1693
+ props: {
1718
1694
  options
1719
1695
  }
1720
1696
  })
1721
- cy.get('.select-root')
1697
+ getHostElement()
1722
1698
  .click()
1723
1699
  .then(() => {
1724
- Cypress.vueWrapper.vm.compRef.setOptionIndex(0)
1700
+ Cypress.vueWrapper.vm.setOptionIndex(0)
1725
1701
  })
1726
1702
  .get('[role="option"]')
1727
1703
  .first()
@@ -1732,21 +1708,21 @@ describe('QSelect API', () => {
1732
1708
  describe('(method): moveOptionSelection', () => {
1733
1709
  it('should move the optionSelection by some index offset', () => {
1734
1710
  const options = [ '1', '2', '3', '4' ]
1735
- mount(WrapperOne, {
1736
- attrs: {
1711
+ mountQSelect({
1712
+ props: {
1737
1713
  options
1738
1714
  }
1739
1715
  })
1740
- cy.get('.select-root')
1716
+ getHostElement()
1741
1717
  .click()
1742
1718
  .then(() => {
1743
- Cypress.vueWrapper.vm.compRef.setOptionIndex(0)
1719
+ Cypress.vueWrapper.vm.setOptionIndex(0)
1744
1720
  })
1745
1721
  .get('[role="option"]')
1746
1722
  .first()
1747
1723
  .should('have.class', 'q-manual-focusable--focused')
1748
1724
  .then(() => {
1749
- Cypress.vueWrapper.vm.compRef.moveOptionSelection(3)
1725
+ Cypress.vueWrapper.vm.moveOptionSelection(3)
1750
1726
  })
1751
1727
  .get('[role="option"]')
1752
1728
  .last()
@@ -1759,18 +1735,18 @@ describe('QSelect API', () => {
1759
1735
  const options = [ '1', '2', '3', '4' ]
1760
1736
  const fn = cy.stub()
1761
1737
  const text = 'test'
1762
- mount(WrapperOne, {
1763
- attrs: {
1738
+ mountQSelect({
1739
+ props: {
1764
1740
  options,
1765
1741
  useInput: true,
1766
1742
  onFilter: fn
1767
1743
  }
1768
1744
  })
1769
- cy.get('.select-root')
1745
+ getHostElement()
1770
1746
  .click()
1771
1747
  .then(() => {
1772
1748
  expect(fn).not.to.be.calledWith(text)
1773
- Cypress.vueWrapper.vm.compRef.filter(text)
1749
+ Cypress.vueWrapper.vm.filter(text)
1774
1750
  expect(fn).to.be.calledWith(text)
1775
1751
  })
1776
1752
  })
@@ -1787,18 +1763,18 @@ describe('QSelect API', () => {
1787
1763
  const options = [ '1', '2', '3', '4' ]
1788
1764
  const fn = cy.stub()
1789
1765
  const text = 'test'
1790
- mount(WrapperOne, {
1791
- attrs: {
1766
+ mountQSelect({
1767
+ props: {
1792
1768
  options,
1793
1769
  useInput: true,
1794
1770
  onFilter: fn
1795
1771
  }
1796
1772
  })
1797
- cy.get('.select-root')
1773
+ getHostElement()
1798
1774
  .click()
1799
1775
  .then(() => {
1800
1776
  expect(fn).not.to.be.calledWith(text)
1801
- Cypress.vueWrapper.vm.compRef.updateInputValue(text)
1777
+ Cypress.vueWrapper.vm.updateInputValue(text)
1802
1778
  expect(fn).to.be.calledWith(text)
1803
1779
  })
1804
1780
  .get('input')
@@ -1809,18 +1785,18 @@ describe('QSelect API', () => {
1809
1785
  const options = [ '1', '2', '3', '4' ]
1810
1786
  const fn = cy.stub()
1811
1787
  const text = 'test'
1812
- mount(WrapperOne, {
1813
- attrs: {
1788
+ mountQSelect({
1789
+ props: {
1814
1790
  options,
1815
1791
  useInput: true,
1816
1792
  onFilter: fn
1817
1793
  }
1818
1794
  })
1819
- cy.get('.select-root')
1795
+ getHostElement()
1820
1796
  .click()
1821
1797
  .then(() => {
1822
1798
  expect(fn).not.to.be.calledWith(text)
1823
- Cypress.vueWrapper.vm.compRef.updateInputValue(text, true)
1799
+ Cypress.vueWrapper.vm.updateInputValue(text, true)
1824
1800
  expect(fn).not.to.be.calledWith(text)
1825
1801
  })
1826
1802
  .get('input')
@@ -1831,17 +1807,17 @@ describe('QSelect API', () => {
1831
1807
  describe('(method): isOptionSelected', () => {
1832
1808
  it('should tell when an option is selected', () => {
1833
1809
  const options = [ '1', '2', '3', '4' ]
1834
- const model = ref([ '1', '2', '4' ])
1835
- mount(WrapperOne, {
1836
- attrs: {
1837
- modelValue: model,
1810
+ const modelValue = [ '1', '2', '4' ]
1811
+ mountQSelect({
1812
+ props: {
1813
+ modelValue,
1838
1814
  multiple: true,
1839
1815
  options
1840
1816
  }
1841
1817
  })
1842
1818
  .then(() => {
1843
- expect(Cypress.vueWrapper.vm.compRef.isOptionSelected(options[ 0 ])).to.be.true
1844
- expect(Cypress.vueWrapper.vm.compRef.isOptionSelected(options[ 2 ])).to.be.false
1819
+ expect(Cypress.vueWrapper.vm.isOptionSelected(options[ 0 ])).to.be.true
1820
+ expect(Cypress.vueWrapper.vm.isOptionSelected(options[ 2 ])).to.be.false
1845
1821
  })
1846
1822
  })
1847
1823
  })
@@ -1849,44 +1825,44 @@ describe('QSelect API', () => {
1849
1825
  describe('(method): getEmittingOptionValue', () => {
1850
1826
  it('should return the emit value with plain options', () => {
1851
1827
  const options = [ '1', '2', '3', '4' ]
1852
- const model = ref('1')
1853
- mount(WrapperOne, {
1854
- attrs: {
1855
- modelValue: model,
1828
+ const modelValue = '1'
1829
+ mountQSelect({
1830
+ props: {
1831
+ modelValue,
1856
1832
  options
1857
1833
  }
1858
1834
  })
1859
1835
  .then(() => {
1860
- expect(Cypress.vueWrapper.vm.compRef.getEmittingOptionValue(options[ 2 ])).to.equal(options[ 2 ])
1836
+ expect(Cypress.vueWrapper.vm.getEmittingOptionValue(options[ 2 ])).to.equal(options[ 2 ])
1861
1837
  })
1862
1838
  })
1863
1839
 
1864
1840
  it('should return the emit value with object options', () => {
1865
1841
  const options = [ { label: '1', value: 1 }, { label: '2', value: 2 }, { label: '3', value: 3 } ]
1866
- const model = ref(options[ 0 ])
1867
- mount(WrapperOne, {
1868
- attrs: {
1869
- modelValue: model,
1842
+ const modelValue = options[ 0 ]
1843
+ mountQSelect({
1844
+ props: {
1845
+ modelValue,
1870
1846
  options
1871
1847
  }
1872
1848
  })
1873
1849
  .then(() => {
1874
- expect(Cypress.vueWrapper.vm.compRef.getEmittingOptionValue(options[ 2 ])).to.equal(options[ 2 ])
1850
+ expect(Cypress.vueWrapper.vm.getEmittingOptionValue(options[ 2 ])).to.equal(options[ 2 ])
1875
1851
  })
1876
1852
  })
1877
1853
 
1878
1854
  it('should respect emit-value when using options', () => {
1879
1855
  const options = [ { label: '1', value: 1 }, { label: '2', value: 2 }, { label: '3', value: 3 } ]
1880
- const model = ref(options[ 0 ])
1881
- mount(WrapperOne, {
1882
- attrs: {
1883
- modelValue: model,
1856
+ const modelValue = options[ 0 ]
1857
+ mountQSelect({
1858
+ props: {
1859
+ modelValue,
1884
1860
  options,
1885
1861
  emitValue: true
1886
1862
  }
1887
1863
  })
1888
1864
  .then(() => {
1889
- expect(Cypress.vueWrapper.vm.compRef.getEmittingOptionValue(options[ 2 ])).to.equal(options[ 2 ].value)
1865
+ expect(Cypress.vueWrapper.vm.getEmittingOptionValue(options[ 2 ])).to.equal(options[ 2 ].value)
1890
1866
  })
1891
1867
  })
1892
1868
  })
@@ -1894,44 +1870,44 @@ describe('QSelect API', () => {
1894
1870
  describe('(method): getOptionValue', () => {
1895
1871
  it('should return the option value with plain options', () => {
1896
1872
  const options = [ '1', '2', '3', '4' ]
1897
- const model = ref('1')
1898
- mount(WrapperOne, {
1899
- attrs: {
1900
- modelValue: model,
1873
+ const modelValue = '1'
1874
+ mountQSelect({
1875
+ props: {
1876
+ modelValue,
1901
1877
  options
1902
1878
  }
1903
1879
  })
1904
1880
  .then(() => {
1905
- expect(Cypress.vueWrapper.vm.compRef.getOptionValue(options[ 2 ])).to.equal(options[ 2 ])
1881
+ expect(Cypress.vueWrapper.vm.getOptionValue(options[ 2 ])).to.equal(options[ 2 ])
1906
1882
  })
1907
1883
  })
1908
1884
 
1909
1885
  it('should return the option value with object options (value by default)', () => {
1910
1886
  const options = [ { label: '1', value: 1 }, { label: '2', value: 2 }, { label: '3', value: 3 } ]
1911
- const model = ref(options[ 0 ])
1912
- mount(WrapperOne, {
1913
- attrs: {
1914
- modelValue: model,
1887
+ const modelValue = options[ 0 ]
1888
+ mountQSelect({
1889
+ props: {
1890
+ modelValue,
1915
1891
  options
1916
1892
  }
1917
1893
  })
1918
1894
  .then(() => {
1919
- expect(Cypress.vueWrapper.vm.compRef.getOptionValue(options[ 2 ])).to.equal(options[ 2 ].value)
1895
+ expect(Cypress.vueWrapper.vm.getOptionValue(options[ 2 ])).to.equal(options[ 2 ].value)
1920
1896
  })
1921
1897
  })
1922
1898
 
1923
1899
  it('should respect the option-value option', () => {
1924
1900
  const options = [ { label: '1', test: 1 }, { label: '2', test: 2 }, { label: '3', test: 3 } ]
1925
- const model = ref(options[ 0 ])
1926
- mount(WrapperOne, {
1927
- attrs: {
1928
- modelValue: model,
1901
+ const modelValue = options[ 0 ]
1902
+ mountQSelect({
1903
+ props: {
1904
+ modelValue,
1929
1905
  options,
1930
1906
  optionValue: 'test'
1931
1907
  }
1932
1908
  })
1933
1909
  .then(() => {
1934
- expect(Cypress.vueWrapper.vm.compRef.getOptionValue(options[ 2 ])).to.equal(options[ 2 ].test)
1910
+ expect(Cypress.vueWrapper.vm.getOptionValue(options[ 2 ])).to.equal(options[ 2 ].test)
1935
1911
  })
1936
1912
  })
1937
1913
  })
@@ -1939,44 +1915,44 @@ describe('QSelect API', () => {
1939
1915
  describe('(method): getOptionLabel', () => {
1940
1916
  it('should return the option label with plain options', () => {
1941
1917
  const options = [ '1', '2', '3', '4' ]
1942
- const model = ref('1')
1943
- mount(WrapperOne, {
1944
- attrs: {
1945
- modelValue: model,
1918
+ const modelValue = '1'
1919
+ mountQSelect({
1920
+ props: {
1921
+ modelValue,
1946
1922
  options
1947
1923
  }
1948
1924
  })
1949
1925
  .then(() => {
1950
- expect(Cypress.vueWrapper.vm.compRef.getOptionLabel(options[ 2 ])).to.equal(options[ 2 ])
1926
+ expect(Cypress.vueWrapper.vm.getOptionLabel(options[ 2 ])).to.equal(options[ 2 ])
1951
1927
  })
1952
1928
  })
1953
1929
 
1954
1930
  it('should return the option label with object options (label by default)', () => {
1955
1931
  const options = [ { label: '1', value: 1 }, { label: '2', value: 2 }, { label: '3', value: 3 } ]
1956
- const model = ref(options[ 0 ])
1957
- mount(WrapperOne, {
1958
- attrs: {
1959
- modelValue: model,
1932
+ const modelValue = options[ 0 ]
1933
+ mountQSelect({
1934
+ props: {
1935
+ modelValue,
1960
1936
  options
1961
1937
  }
1962
1938
  })
1963
1939
  .then(() => {
1964
- expect(Cypress.vueWrapper.vm.compRef.getOptionLabel(options[ 2 ])).to.equal(options[ 2 ].label)
1940
+ expect(Cypress.vueWrapper.vm.getOptionLabel(options[ 2 ])).to.equal(options[ 2 ].label)
1965
1941
  })
1966
1942
  })
1967
1943
 
1968
1944
  it('should respect the option-value option', () => {
1969
1945
  const options = [ { test: '1', value: 1 }, { test: '2', value: 2 }, { test: '3', value: 3 } ]
1970
- const model = ref(options[ 0 ])
1971
- mount(WrapperOne, {
1972
- attrs: {
1973
- modelValue: model,
1946
+ const modelValue = options[ 0 ]
1947
+ mountQSelect({
1948
+ props: {
1949
+ modelValue,
1974
1950
  options,
1975
1951
  optionLabel: 'test'
1976
1952
  }
1977
1953
  })
1978
1954
  .then(() => {
1979
- expect(Cypress.vueWrapper.vm.compRef.getOptionLabel(options[ 2 ])).to.equal(options[ 2 ].test)
1955
+ expect(Cypress.vueWrapper.vm.getOptionLabel(options[ 2 ])).to.equal(options[ 2 ].test)
1980
1956
  })
1981
1957
  })
1982
1958
  })
@@ -1984,18 +1960,18 @@ describe('QSelect API', () => {
1984
1960
  describe('(method): isOptionDisabled', () => {
1985
1961
  it('should return if an option is disabled correctly', () => {
1986
1962
  const options = [ { label: '1', value: 1, disable: true }, { label: '2', value: 2 }, { label: '3', value: 3 } ]
1987
- const model = ref(options[ 0 ])
1988
- mount(WrapperOne, {
1989
- attrs: {
1990
- modelValue: model,
1963
+ const modelValue = options[ 0 ]
1964
+ mountQSelect({
1965
+ props: {
1966
+ modelValue,
1991
1967
  options
1992
1968
  }
1993
1969
  })
1994
1970
  .then(() => {
1995
- expect(Cypress.vueWrapper.vm.compRef.isOptionDisabled(options[ 0 ])).to.be.true
1971
+ expect(Cypress.vueWrapper.vm.isOptionDisabled(options[ 0 ])).to.be.true
1996
1972
  // This currently fails: https://github.com/quasarframework/quasar/issues/12046
1997
- // expect(Cypress.vueWrapper.vm.compRef.isOptionDisabled(options[ 1 ])).to.be.false
1998
- // expect(Cypress.vueWrapper.vm.compRef.isOptionDisabled(options[ 2 ])).to.be.false
1973
+ // expect(Cypress.vueWrapper.vm.isOptionDisabled(options[ 1 ])).to.be.false
1974
+ // expect(Cypress.vueWrapper.vm.isOptionDisabled(options[ 2 ])).to.be.false
1999
1975
  })
2000
1976
  })
2001
1977
  })