quasar 2.17.6 → 2.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (291) hide show
  1. package/dist/api/QBtnDropdown.json +1 -1
  2. package/dist/api/QDialog.json +1 -1
  3. package/dist/api/QMenu.json +1 -1
  4. package/dist/api/QOptionGroup.json +1 -1
  5. package/dist/api/QSelect.json +1 -1
  6. package/dist/api/QTable.json +1 -1
  7. package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
  8. package/dist/icon-set/eva-icons.umd.prod.js +1 -1
  9. package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
  10. package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
  11. package/dist/icon-set/fontawesome-v6-pro.umd.prod.js +1 -1
  12. package/dist/icon-set/fontawesome-v6.umd.prod.js +1 -1
  13. package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
  14. package/dist/icon-set/line-awesome.umd.prod.js +1 -1
  15. package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
  16. package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
  17. package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
  18. package/dist/icon-set/material-icons.umd.prod.js +1 -1
  19. package/dist/icon-set/material-symbols-outlined.umd.prod.js +1 -1
  20. package/dist/icon-set/material-symbols-rounded.umd.prod.js +1 -1
  21. package/dist/icon-set/material-symbols-sharp.umd.prod.js +1 -1
  22. package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
  23. package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
  24. package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
  25. package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
  26. package/dist/icon-set/mdi-v7.umd.prod.js +1 -1
  27. package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
  28. package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
  29. package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
  30. package/dist/icon-set/svg-fontawesome-v6.umd.prod.js +1 -1
  31. package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
  32. package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
  33. package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
  34. package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
  35. package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
  36. package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
  37. package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
  38. package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
  39. package/dist/icon-set/svg-material-symbols-outlined.umd.prod.js +1 -1
  40. package/dist/icon-set/svg-material-symbols-rounded.umd.prod.js +1 -1
  41. package/dist/icon-set/svg-material-symbols-sharp.umd.prod.js +1 -1
  42. package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
  43. package/dist/icon-set/svg-mdi-v7.umd.prod.js +1 -1
  44. package/dist/icon-set/svg-themify.umd.prod.js +1 -1
  45. package/dist/icon-set/themify.umd.prod.js +1 -1
  46. package/dist/lang/ar-TN.umd.prod.js +2 -2
  47. package/dist/lang/ar.umd.prod.js +2 -2
  48. package/dist/lang/az-Latn.umd.prod.js +2 -2
  49. package/dist/lang/bg.umd.prod.js +2 -2
  50. package/dist/lang/bn.umd.prod.js +2 -2
  51. package/dist/lang/bs-BA.umd.prod.js +2 -2
  52. package/dist/lang/ca.umd.prod.js +2 -2
  53. package/dist/lang/cs.umd.prod.js +2 -2
  54. package/dist/lang/da.umd.prod.js +2 -2
  55. package/dist/lang/de-CH.umd.prod.js +2 -2
  56. package/dist/lang/de-DE.umd.prod.js +2 -2
  57. package/dist/lang/de.umd.prod.js +2 -2
  58. package/dist/lang/el.umd.prod.js +2 -2
  59. package/dist/lang/en-GB.umd.prod.js +2 -2
  60. package/dist/lang/en-US.umd.prod.js +2 -2
  61. package/dist/lang/eo.umd.prod.js +2 -2
  62. package/dist/lang/es.umd.prod.js +2 -2
  63. package/dist/lang/et.umd.prod.js +2 -2
  64. package/dist/lang/eu.umd.prod.js +2 -2
  65. package/dist/lang/fa-IR.umd.prod.js +2 -2
  66. package/dist/lang/fa.umd.prod.js +2 -2
  67. package/dist/lang/fi.umd.prod.js +2 -2
  68. package/dist/lang/fr.umd.prod.js +2 -2
  69. package/dist/lang/gn.umd.prod.js +2 -2
  70. package/dist/lang/he.umd.prod.js +2 -2
  71. package/dist/lang/hi.umd.prod.js +2 -2
  72. package/dist/lang/hr.umd.prod.js +2 -2
  73. package/dist/lang/hu.umd.prod.js +2 -2
  74. package/dist/lang/id.umd.prod.js +2 -2
  75. package/dist/lang/is.umd.prod.js +2 -2
  76. package/dist/lang/it.umd.prod.js +2 -2
  77. package/dist/lang/ja.umd.prod.js +2 -2
  78. package/dist/lang/kk.umd.prod.js +2 -2
  79. package/dist/lang/km.umd.prod.js +2 -2
  80. package/dist/lang/ko-KR.umd.prod.js +2 -2
  81. package/dist/lang/kur-CKB.umd.prod.js +2 -2
  82. package/dist/lang/lt.umd.prod.js +2 -2
  83. package/dist/lang/lu.umd.prod.js +2 -2
  84. package/dist/lang/lv.umd.prod.js +2 -2
  85. package/dist/lang/mk.umd.prod.js +2 -2
  86. package/dist/lang/ml.umd.prod.js +2 -2
  87. package/dist/lang/mm.umd.prod.js +2 -2
  88. package/dist/lang/ms-MY.umd.prod.js +2 -2
  89. package/dist/lang/ms.umd.prod.js +2 -2
  90. package/dist/lang/my.umd.prod.js +2 -2
  91. package/dist/lang/nb-NO.umd.prod.js +2 -2
  92. package/dist/lang/nl.umd.prod.js +2 -2
  93. package/dist/lang/pl.umd.prod.js +2 -2
  94. package/dist/lang/pt-BR.umd.prod.js +2 -2
  95. package/dist/lang/pt.umd.prod.js +2 -2
  96. package/dist/lang/ro.umd.prod.js +2 -2
  97. package/dist/lang/ru.umd.prod.js +2 -2
  98. package/dist/lang/sk.umd.prod.js +2 -2
  99. package/dist/lang/sl.umd.prod.js +2 -2
  100. package/dist/lang/sm.umd.prod.js +2 -2
  101. package/dist/lang/sr-CYR.umd.prod.js +2 -2
  102. package/dist/lang/sr.umd.prod.js +2 -2
  103. package/dist/lang/sv.umd.prod.js +2 -2
  104. package/dist/lang/ta.umd.prod.js +2 -2
  105. package/dist/lang/th.umd.prod.js +2 -2
  106. package/dist/lang/tl.umd.prod.js +2 -2
  107. package/dist/lang/tr.umd.prod.js +2 -2
  108. package/dist/lang/ug.umd.prod.js +1 -1
  109. package/dist/lang/uk.umd.prod.js +2 -2
  110. package/dist/lang/ur-PK.umd.prod.js +7 -0
  111. package/dist/lang/uz-Cyrl.umd.prod.js +2 -2
  112. package/dist/lang/uz-Latn.umd.prod.js +2 -2
  113. package/dist/lang/vi.umd.prod.js +2 -2
  114. package/dist/lang/zh-CN.umd.prod.js +2 -2
  115. package/dist/lang/zh-TW.umd.prod.js +2 -2
  116. package/dist/quasar.client.js +252 -179
  117. package/dist/quasar.css +1 -1
  118. package/dist/quasar.prod.css +1 -1
  119. package/dist/quasar.rtl.css +1 -1
  120. package/dist/quasar.rtl.prod.css +1 -1
  121. package/dist/quasar.sass +2 -2
  122. package/dist/quasar.server.prod.cjs +36 -36
  123. package/dist/quasar.server.prod.js +37 -37
  124. package/dist/quasar.umd.js +252 -179
  125. package/dist/quasar.umd.prod.js +42 -42
  126. package/dist/types/index.d.ts +86 -17
  127. package/dist/vetur/quasar-attributes.json +1 -1
  128. package/dist/vetur/quasar-tags.json +1 -1
  129. package/dist/web-types/web-types.json +1 -1
  130. package/lang/ar-TN.js +6 -0
  131. package/lang/ar.js +6 -0
  132. package/lang/az-Latn.js +6 -0
  133. package/lang/bg.js +6 -0
  134. package/lang/bn.js +6 -0
  135. package/lang/bs-BA.js +6 -0
  136. package/lang/ca.js +6 -0
  137. package/lang/cs.js +6 -0
  138. package/lang/da.js +6 -0
  139. package/lang/de-CH.js +6 -0
  140. package/lang/de-DE.js +6 -0
  141. package/lang/de.js +6 -0
  142. package/lang/el.js +6 -0
  143. package/lang/en-GB.js +6 -0
  144. package/lang/en-US.js +6 -0
  145. package/lang/eo.js +6 -0
  146. package/lang/es.js +6 -0
  147. package/lang/et.js +6 -0
  148. package/lang/eu.js +6 -0
  149. package/lang/fa-IR.js +6 -0
  150. package/lang/fa.js +6 -0
  151. package/lang/fi.js +6 -0
  152. package/lang/fr.js +6 -0
  153. package/lang/gn.js +6 -0
  154. package/lang/he.js +6 -0
  155. package/lang/hi.js +6 -0
  156. package/lang/hr.js +6 -0
  157. package/lang/hu.js +6 -0
  158. package/lang/id.js +6 -0
  159. package/lang/index.json +1 -1
  160. package/lang/is.js +6 -0
  161. package/lang/it.js +6 -0
  162. package/lang/ja.js +6 -0
  163. package/lang/kk.js +6 -0
  164. package/lang/km.js +6 -0
  165. package/lang/ko-KR.js +6 -0
  166. package/lang/kur-CKB.js +6 -0
  167. package/lang/lt.js +6 -0
  168. package/lang/lu.js +6 -0
  169. package/lang/lv.js +6 -0
  170. package/lang/mk.js +6 -0
  171. package/lang/ml.js +6 -0
  172. package/lang/mm.js +6 -0
  173. package/lang/ms-MY.js +6 -0
  174. package/lang/ms.js +6 -0
  175. package/lang/my.js +6 -0
  176. package/lang/nb-NO.js +6 -0
  177. package/lang/nl.js +6 -0
  178. package/lang/pl.js +6 -0
  179. package/lang/pt-BR.js +6 -0
  180. package/lang/pt.js +6 -0
  181. package/lang/ro.js +6 -0
  182. package/lang/ru.js +6 -0
  183. package/lang/sk.js +6 -0
  184. package/lang/sl.js +6 -0
  185. package/lang/sm.js +6 -0
  186. package/lang/sr-CYR.js +6 -0
  187. package/lang/sr.js +6 -0
  188. package/lang/sv.js +6 -0
  189. package/lang/ta.js +6 -0
  190. package/lang/th.js +6 -0
  191. package/lang/tl.js +6 -0
  192. package/lang/tr.js +6 -0
  193. package/lang/uk.js +6 -0
  194. package/lang/ur-PK.js +111 -0
  195. package/lang/uz-Cyrl.js +6 -0
  196. package/lang/uz-Latn.js +6 -0
  197. package/lang/vi.js +6 -0
  198. package/lang/zh-CN.js +6 -0
  199. package/lang/zh-TW.js +6 -0
  200. package/package.json +4 -4
  201. package/src/components/breadcrumbs/QBreadcrumbs.js +2 -2
  202. package/src/components/btn/QBtn.js +7 -8
  203. package/src/components/btn-dropdown/QBtnDropdown.js +10 -4
  204. package/src/components/btn-dropdown/QBtnDropdown.json +21 -0
  205. package/src/components/color/QColor.js +1 -1
  206. package/src/components/date/QDate.js +14 -7
  207. package/src/components/dialog/QDialog.js +2 -2
  208. package/src/components/dialog/QDialog.json +1 -1
  209. package/src/components/drawer/QDrawer.js +3 -5
  210. package/src/components/editor/QEditor.js +1 -1
  211. package/src/components/editor/editor-caret.js +1 -1
  212. package/src/components/editor/editor-utils.js +2 -2
  213. package/src/components/expansion-item/QExpansionItem.js +6 -3
  214. package/src/components/fab/QFab.js +2 -2
  215. package/src/components/form/QForm.js +2 -2
  216. package/src/components/form/QFormChildMixin.js +6 -4
  217. package/src/components/icon/QIcon.js +2 -2
  218. package/src/components/infinite-scroll/QInfiniteScroll.js +2 -4
  219. package/src/components/input/QInput.js +3 -3
  220. package/src/components/item/QItem.js +1 -1
  221. package/src/components/menu/QMenu.js +8 -5
  222. package/src/components/menu/QMenu.json +8 -1
  223. package/src/components/option-group/QOptionGroup.json +1 -17
  224. package/src/components/pagination/QPagination.js +8 -4
  225. package/src/components/parallax/QParallax.js +1 -1
  226. package/src/components/popup-edit/QPopupEdit.js +2 -2
  227. package/src/components/pull-to-refresh/QPullToRefresh.js +1 -1
  228. package/src/components/rating/QRating.sass +1 -1
  229. package/src/components/resize-observer/QResizeObserver.js +1 -1
  230. package/src/components/scroll-observer/QScrollObserver.js +2 -2
  231. package/src/components/select/QSelect.js +8 -6
  232. package/src/components/select/QSelect.json +2 -2
  233. package/src/components/slide-transition/QSlideTransition.js +2 -2
  234. package/src/components/stepper/StepHeader.js +1 -1
  235. package/src/components/table/QTable.js +84 -36
  236. package/src/components/table/QTable.json +138 -0
  237. package/src/components/table/QTr.js +4 -1
  238. package/src/components/table/table-sort.js +1 -1
  239. package/src/components/tabs/QTabs.js +2 -2
  240. package/src/components/tabs/use-tab.js +4 -4
  241. package/src/components/time/QTime.js +1 -1
  242. package/src/components/tree/QTree.js +2 -3
  243. package/src/components/virtual-scroll/use-virtual-scroll.js +3 -3
  244. package/src/composables/private.use-field/use-field.js +5 -5
  245. package/src/composables/private.use-file/use-file.js +6 -3
  246. package/src/composables/private.use-model-toggle/use-model-toggle.js +2 -2
  247. package/src/composables/private.use-refocus-target/use-refocus-target.js +6 -5
  248. package/src/composables/private.use-validate/use-validate.js +1 -1
  249. package/src/directives/intersection/Intersection.js +2 -2
  250. package/src/directives/morph/Morph.js +2 -2
  251. package/src/directives/mutation/Mutation.js +2 -2
  252. package/src/directives/touch-hold/TouchHold.js +2 -2
  253. package/src/directives/touch-pan/TouchPan.js +2 -2
  254. package/src/directives/touch-repeat/TouchRepeat.js +3 -3
  255. package/src/directives/touch-swipe/TouchSwipe.js +3 -3
  256. package/src/plugins/lang/Lang.test.js +12 -0
  257. package/src/plugins/loading/Loading.js +1 -1
  258. package/src/plugins/notify/Notify.js +1 -1
  259. package/src/plugins/private.body/Body.js +1 -1
  260. package/src/plugins/private.history/History.js +1 -1
  261. package/src/plugins/screen/Screen.js +1 -1
  262. package/src/utils/morph/morph.js +13 -10
  263. package/src/utils/open-url/open-url.js +3 -3
  264. package/src/utils/private.dialog/create-dialog.js +2 -2
  265. package/src/utils/private.portal/portal.js +1 -1
  266. package/src/components/date/__tests__/QDate.cy.js +0 -189
  267. package/src/components/date/__tests__/use-datetime.cy.js +0 -83
  268. package/src/components/editor/__tests__/QEditor.cy.js +0 -195
  269. package/src/components/field/__tests__/QField.cy.js +0 -156
  270. package/src/components/input/__tests__/QInput.cy.js +0 -786
  271. package/src/components/input/__tests__/use-mask.cy.js +0 -124
  272. package/src/components/menu/__tests__/QMenu.cy.js +0 -634
  273. package/src/components/menu/__tests__/WrapperOne.vue +0 -51
  274. package/src/components/menu/__tests__/WrapperTwo.vue +0 -38
  275. package/src/components/select/__tests__/QSelect.cy.js +0 -2018
  276. package/src/components/table/__tests__/QTable.cy.js +0 -635
  277. package/src/components/table/__tests__/QTd.cy.js +0 -35
  278. package/src/components/table/__tests__/QTh.cy.js +0 -27
  279. package/src/components/table/__tests__/QTr.cy.js +0 -27
  280. package/src/components/tabs/__tests__/QTab.cy.js +0 -79
  281. package/src/components/tabs/__tests__/QTabs.cy.js +0 -147
  282. package/src/components/uploader/__tests__/QUploader.cy.js +0 -191
  283. package/src/composables/__tests__/FieldWrapper.vue +0 -54
  284. package/src/composables/__tests__/use-anchor.cy.js +0 -98
  285. package/src/composables/__tests__/use-field.cy.js +0 -547
  286. package/src/composables/__tests__/use-file.cy.js +0 -69
  287. package/src/composables/__tests__/use-fullscreen.cy.js +0 -37
  288. package/src/composables/__tests__/use-model-toggle.cy.js +0 -350
  289. package/src/composables/__tests__/use-portal.cy.js +0 -4
  290. package/src/composables/__tests__/use-router-link.cy.js +0 -55
  291. package/src/composables/__tests__/use-validate.cy.js +0 -257
@@ -1,634 +0,0 @@
1
- /* eslint-disable no-unused-expressions */
2
- import WrapperOne from './WrapperOne.vue'
3
- import WrapperTwo from './WrapperTwo.vue'
4
-
5
- describe('Menu API', () => {
6
- describe('Props', () => {
7
- describe('Category: behavior', () => {
8
- describe('(prop): scroll-target', () => {
9
- it.skip(' ', () => {
10
- // Todo: Check if test for this needs to be added.
11
- })
12
- })
13
-
14
- describe('(prop): touch-position', () => {
15
- it('should show menu at the position of the click', () => {
16
- cy.mount(WrapperOne, {
17
- props: {
18
- 'touch-position': true
19
- }
20
- })
21
-
22
- const mouseX = 75
23
- const mouseY = 25
24
- let elementX = 0
25
- let elementY = 0
26
-
27
- cy.dataCy('wrapper')
28
- .then(($el) => {
29
- const rect = $el[ 0 ].getBoundingClientRect()
30
- elementX = rect.left
31
- elementY = rect.top
32
- })
33
- .click(mouseX, mouseY)
34
- cy.dataCy('menu')
35
- .should('exist')
36
- .then(($el) => {
37
- expect($el[ 0 ].offsetLeft).to.equal(mouseX + elementX)
38
- // TODO: check if the Y position being off by 1 is intentional
39
- expect($el[ 0 ].offsetTop).to.equal(mouseY + 1 + elementY)
40
- })
41
- })
42
- })
43
-
44
- describe('(prop): persistent', () => {
45
- it('should close the menu when clicking outside the menu', () => {
46
- cy.mount(WrapperOne)
47
-
48
- cy.dataCy('wrapper')
49
- .click()
50
- cy.dataCy('menu')
51
- .should('exist')
52
- cy.get('body')
53
- .click(499, 0)
54
- cy.get('body').dataCy('menu')
55
- .should('not.exist')
56
- })
57
-
58
- it('should close the menu when hitting the escape key', () => {
59
- cy.mount(WrapperOne)
60
-
61
- cy.dataCy('wrapper')
62
- .click()
63
- cy.dataCy('menu')
64
- .should('exist')
65
- cy.get('body')
66
- .type('{esc}')
67
- cy.get('body').dataCy('menu')
68
- .should('not.exist')
69
- })
70
-
71
- it('should not close the menu when clicking outside the menu when persistent', () => {
72
- cy.mount(WrapperOne, {
73
- props: {
74
- persistent: true
75
- }
76
- })
77
-
78
- cy.dataCy('wrapper')
79
- .click()
80
- cy.dataCy('menu')
81
- .should('exist')
82
- cy.get('body')
83
- .click(499, 0, { waitForAnimations: true }) // Await menu animation otherwise it always passes
84
- cy.get('body')
85
- .dataCy('menu')
86
- .should('exist')
87
- })
88
-
89
- it('should not close the menu when hitting the escape key when persistent', () => {
90
- cy.mount(WrapperOne, {
91
- props: {
92
- persistent: true
93
- }
94
- })
95
-
96
- cy.dataCy('wrapper')
97
- .click()
98
- cy.dataCy('menu')
99
- .should('exist')
100
- cy.get('body')
101
- .type('{esc}', { waitForAnimations: true }) // Await menu animation otherwise it always passes
102
- cy.get('body')
103
- .dataCy('menu')
104
- .should('exist')
105
- })
106
- })
107
-
108
- describe('(prop): no-route-dismiss', () => {
109
- it.skip(' ', () => {
110
- // This needs a vue-router, not possible with a unit test
111
- })
112
- })
113
-
114
- describe('(prop): auto-close', () => {
115
- it('should not close the menu when clicking a menu child without v-close-popup', () => {
116
- cy.mount(WrapperOne)
117
-
118
- cy.dataCy('wrapper')
119
- .click()
120
- cy.dataCy('menu')
121
- .should('exist')
122
- .dataCy('keep-open')
123
- .click({ waitForAnimations: true }) // Await menu animation otherwise it always passes
124
- cy.dataCy('menu')
125
- .should('exist')
126
- })
127
-
128
- it('should close the menu when clicking a menu child without v-close-popup when auto-close is true', () => {
129
- cy.mount(WrapperOne, {
130
- props: {
131
- 'auto-close': true
132
- }
133
- })
134
-
135
- cy.dataCy('wrapper')
136
- .click()
137
- cy.dataCy('menu')
138
- .should('exist')
139
- .dataCy('keep-open')
140
- .click({ waitForAnimations: true }) // Await menu animation otherwise it always passes
141
- cy.dataCy('menu')
142
- .should('not.exist')
143
- })
144
- })
145
-
146
- describe('(prop): separate-close-popup', () => {
147
- it.skip(' ', () => {
148
- // Todo: Check if this needs to be tested
149
- })
150
- })
151
-
152
- describe('(prop): no-refocus', () => {
153
- // TODO: it is not clear from the docs that refocussing does not happen when clicking outside or closing by escape/programatticaly. Should this be added?
154
- it('should switch focus back to parent element when closing', () => {
155
- cy.mount(WrapperOne)
156
-
157
- cy.dataCy('wrapper')
158
- .focus()
159
- cy.dataCy('wrapper')
160
- .should('have.focus')
161
- .click()
162
- cy.dataCy('menu')
163
- .should('exist')
164
- .should('have.focus')
165
- cy.dataCy('menu')
166
- .dataCy('close-popup')
167
- .click({ waitForAnimations: true }) // Wait for menu transition
168
- cy.dataCy('wrapper')
169
- .get('.q-focus-helper')
170
- .should('have.focus')
171
- })
172
-
173
- it('should not switch focus back to parent element when closing if no-refocus is true', () => {
174
- cy.mount(WrapperOne, {
175
- props: {
176
- 'no-refocus': true
177
- }
178
- })
179
-
180
- cy.dataCy('wrapper')
181
- .focus()
182
- cy.dataCy('wrapper')
183
- .should('have.focus')
184
- .click()
185
- cy.dataCy('menu')
186
- .should('exist')
187
- .should('have.focus')
188
- cy.dataCy('menu')
189
- .dataCy('close-popup')
190
- .click({ waitForAnimations: true }) // Wait for menu transition
191
- cy.dataCy('wrapper')
192
- .get('.q-focus-helper')
193
- .should('not.have.focus')
194
- })
195
- })
196
-
197
- describe('(prop): no-focus', () => {
198
- it('should switch focus to the menu when opening', () => {
199
- cy.mount(WrapperOne)
200
-
201
- cy.dataCy('wrapper')
202
- .click()
203
- cy.dataCy('menu')
204
- .should('exist')
205
- .should('have.focus')
206
- })
207
-
208
- it('should no switch focus to the menu when opening with no-focus is true', () => {
209
- cy.mount(WrapperOne, {
210
- props: {
211
- 'no-focus': true
212
- }
213
- })
214
-
215
- cy.dataCy('wrapper')
216
- .click()
217
- cy.dataCy('menu')
218
- .should('exist')
219
- .should('not.have.focus')
220
- })
221
- })
222
- })
223
-
224
- describe('Category: position', () => {
225
- describe('(prop): fit', () => {
226
- it('should show a menu that matches the full with of the target when fit is supplied', () => {
227
- cy.mount(WrapperOne, {
228
- props: {
229
- target: '.other-target',
230
- fit: true
231
- }
232
- })
233
- let targetWidth = 0
234
- cy.dataCy('other-target')
235
- .then(($el) => {
236
- targetWidth = $el[ 0 ].clientWidth
237
- })
238
- .click()
239
- cy.dataCy('menu')
240
- .then(($el) => {
241
- expect($el[ 0 ].clientWidth).to.equal(targetWidth)
242
- })
243
- })
244
-
245
- it('should show a menu that not matches the full with of the target when fit is false', () => {
246
- cy.mount(WrapperOne, {
247
- props: {
248
- target: '.other-target',
249
- fit: false
250
- }
251
- })
252
- let targetWidth = 0
253
- cy.dataCy('other-target')
254
- .then(($el) => {
255
- targetWidth = $el[ 0 ].clientWidth
256
- })
257
- .click()
258
- cy.dataCy('menu')
259
- .then(($el) => {
260
- expect($el[ 0 ].clientWidth).not.to.equal(targetWidth)
261
- })
262
- })
263
- })
264
-
265
- describe('(prop): cover', () => {
266
- it('should show a menu that overlays the target when using cover', () => {
267
- cy.mount(WrapperOne, {
268
- props: {
269
- cover: true
270
- }
271
- })
272
- cy.dataCy('wrapper')
273
- .click()
274
-
275
- cy.dataCy('menu')
276
- .checkVerticalPosition('wrapper', 'center', 'center')
277
-
278
- cy.dataCy('menu')
279
- .checkHorizontalPosition('wrapper', 'middle', 'middle')
280
- })
281
-
282
- it('should show a menu that overlays the target when using cover', () => {
283
- cy.mount(WrapperOne, {
284
- props: {
285
- cover: true,
286
- target: '.other-target'
287
- }
288
- })
289
- cy.dataCy('other-target')
290
- .click()
291
-
292
- cy.dataCy('menu')
293
- .checkVerticalPosition('other-target', 'center', 'center')
294
-
295
- cy.dataCy('menu')
296
- .checkHorizontalPosition('other-target', 'middle', 'middle')
297
- })
298
-
299
- it('should ignore self property when using cover', () => {
300
- cy.mount(WrapperOne, {
301
- props: {
302
- cover: true,
303
- self: 'center right',
304
- target: '.other-target'
305
- }
306
- })
307
- cy.dataCy('other-target')
308
- .click()
309
-
310
- cy.dataCy('menu')
311
- .checkVerticalPosition('other-target', 'center', 'center')
312
-
313
- cy.dataCy('menu')
314
- .checkHorizontalPosition('other-target', 'middle', 'middle')
315
- })
316
- })
317
-
318
- describe('(prop): anchor & self', () => {
319
- it('should show a menu at anchor: bottom left and self: top left by default', () => {
320
- cy.mount(WrapperOne)
321
-
322
- cy.dataCy('wrapper')
323
- .click()
324
-
325
- cy.dataCy('menu')
326
- .checkVerticalPosition('wrapper', 'bottom', 'top')
327
-
328
- cy.dataCy('menu')
329
- .checkHorizontalPosition('wrapper', 'left', 'left')
330
- })
331
-
332
- const verticalAnchor = [ 'top', 'center', 'bottom' ]
333
- const horizontalAnchor = [ 'left', 'middle', 'right' ]
334
- const verticalSelf = [ 'top', 'center', 'bottom' ]
335
- const horizontalSelf = [ 'left', 'middle', 'right' ]
336
- verticalAnchor.forEach((vA) => {
337
- horizontalAnchor.forEach((hA) => {
338
- verticalSelf.forEach((vS) => {
339
- horizontalSelf.forEach((hS) => {
340
- it(`should position Anchor(${ vA } ${ hA }) & Self(${ vS } ${ hS }) correctly`, () => {
341
- cy.mount(WrapperOne, {
342
- props: {
343
- anchor: `${ vA } ${ hA }`,
344
- self: `${ vS } ${ hS }`
345
- }
346
- })
347
-
348
- cy.dataCy('wrapper')
349
- .click()
350
-
351
- cy.dataCy('menu')
352
- .checkVerticalPosition('wrapper', vA, vS)
353
-
354
- cy.dataCy('menu')
355
- .checkHorizontalPosition('wrapper', hA, hS)
356
- })
357
- })
358
- })
359
- })
360
- })
361
- })
362
-
363
- describe.skip('(prop): self', () => {
364
- // This property is tested together with anchor above
365
- })
366
-
367
- describe('(prop): offset', () => {
368
- const verticalAnchor = [ 'top', 'center', 'bottom' ]
369
- const verticalSelf = [ 'top', 'center', 'bottom' ]
370
- verticalAnchor.forEach((vA) => {
371
- verticalSelf.forEach((vS) => {
372
- it(`should offset vertical position Anchor(${ vA } left) & Self(${ vS } left) correctly`, () => {
373
- cy.mount(WrapperOne, {
374
- props: {
375
- anchor: `${ vA } left`,
376
- self: `${ vS } left`,
377
- offset: [ 0, 20 ]
378
- }
379
- })
380
-
381
- cy.dataCy('wrapper')
382
- .click()
383
- cy.dataCy('menu')
384
- .checkVerticalPosition('wrapper', vA, vS, 20)
385
- })
386
- })
387
- })
388
-
389
- const horizontalAnchor = [ 'left', 'middle', 'right' ]
390
- const horizontalSelf = [ 'left', 'middle', 'right' ]
391
- horizontalAnchor.forEach((hA) => {
392
- horizontalSelf.forEach((hS) => {
393
- it(`should offset horizontal position Anchor(top ${ hA }) & Self(top ${ hS }) correctly`, () => {
394
- cy.mount(WrapperOne, {
395
- props: {
396
- anchor: `top ${ hA }`,
397
- self: `top ${ hS }`,
398
- offset: [ 20, 0 ]
399
- }
400
- })
401
-
402
- cy.dataCy('wrapper')
403
- .click()
404
- cy.dataCy('menu')
405
- .checkHorizontalPosition('wrapper', hA, hS, 20)
406
- })
407
- })
408
- })
409
- })
410
- })
411
-
412
- describe('Category: style', () => {
413
- describe('(prop): dark', () => {
414
- it('should set the --q-dark color as background and white text color', () => {
415
- cy.mount(WrapperOne, {
416
- props: {
417
- dark: true
418
- }
419
- })
420
- cy.dataCy('wrapper')
421
- .click()
422
- cy.dataCy('menu')
423
- .should('have.color', 'white')
424
- .should('have.backgroundColor', 'var(--q-dark)')
425
- })
426
- })
427
-
428
- describe('(prop): square', () => {
429
- it('should not have border-radius when using this prop', () => {
430
- cy.mount(WrapperOne, {
431
- props: {
432
- square: true
433
- }
434
- })
435
- cy.dataCy('wrapper')
436
- .click()
437
- cy.dataCy('menu')
438
- .should('have.css', 'border-radius', '0px')
439
- })
440
- })
441
-
442
- describe('(prop): max-height', () => {
443
- it('should specify a max-height when setting this prop', () => {
444
- const maxHeight = '30px'
445
- cy.mount(WrapperOne, {
446
- props: {
447
- maxHeight
448
- }
449
- })
450
- cy.dataCy('wrapper')
451
- .click()
452
- cy.dataCy('menu')
453
- .should('have.css', 'max-height', maxHeight)
454
- })
455
- })
456
-
457
- describe('(prop): max-width', () => {
458
- it('should specify a max-width when setting this prop', () => {
459
- const maxWidth = '30px'
460
- cy.mount(WrapperOne, {
461
- props: {
462
- maxWidth
463
- }
464
- })
465
- cy.dataCy('wrapper')
466
- .click()
467
- cy.dataCy('menu')
468
- .should('have.css', 'max-width', maxWidth)
469
- })
470
- })
471
- })
472
- })
473
-
474
- describe('Slots', () => {
475
- describe('(slot): default', () => {
476
- it.skip(' ', () => {
477
- //
478
- })
479
- })
480
- })
481
-
482
- describe('Events', () => {
483
- describe('(event): escape-key', () => {
484
- it('should emit @escape-key event when escape key is pressed', () => {
485
- const fn = cy.stub()
486
- cy.mount(WrapperOne, {
487
- props: {
488
- onEscapeKey: fn
489
- }
490
- })
491
-
492
- expect(fn).not.to.be.called
493
- cy.dataCy('wrapper')
494
- .click()
495
- cy.dataCy('menu')
496
- .should('exist')
497
- .then(() => {
498
- expect(fn).not.to.be.called
499
- })
500
- cy.get('body')
501
- .type('{esc}')
502
- cy.get('body')
503
- .then(() => {
504
- expect(fn).to.be.called
505
- })
506
- })
507
-
508
- it('should not emit @escape-key event when menu is persistent', () => {
509
- const fn = cy.stub()
510
- cy.mount(WrapperOne, {
511
- props: {
512
- onEscapeKey: fn,
513
- persistent: true
514
- }
515
- })
516
-
517
- expect(fn).not.to.be.called
518
- cy.dataCy('wrapper')
519
- .click()
520
- cy.dataCy('menu')
521
- .should('exist')
522
- .then(() => {
523
- expect(fn).not.to.be.called
524
- })
525
- cy.get('body')
526
- .type('{esc}')
527
- cy.get('body')
528
- .then(() => {
529
- expect(fn).not.to.be.called
530
- })
531
- })
532
- })
533
- })
534
-
535
- describe('Methods', () => {
536
- describe('(method): updatePosition', () => {
537
- it('should reposition the menu when it is no longer in correct position', () => {
538
- cy.mount(WrapperTwo, {
539
- props: {
540
- anchor: 'bottom left',
541
- self: 'bottom left'
542
- }
543
- })
544
-
545
- let bottom = null
546
- let left = null
547
-
548
- cy.dataCy('wrapper')
549
- .click({ waitForAnimations: true })
550
- cy.dataCy('menu')
551
- .should('exist')
552
- .checkVerticalPosition('wrapper', 'bottom', 'bottom')
553
-
554
- cy.dataCy('menu')
555
- .checkHorizontalPosition('wrapper', 'left', 'left')
556
-
557
- cy.dataCy('menu')
558
- .then(($el) => {
559
- const rect = $el[ 0 ].getBoundingClientRect()
560
- bottom = rect.bottom
561
- left = rect.left
562
- })
563
-
564
- cy.dataCy('div')
565
- .then(($el) => {
566
- $el[ 0 ].style.height = '100px'
567
- cy.dataCy('menu')
568
- .then(($el) => {
569
- const rect = $el[ 0 ].getBoundingClientRect()
570
- expect(rect.bottom).to.equal(bottom - 100)
571
- expect(rect.left).to.equal(left)
572
- })
573
-
574
- cy.dataCy('wrapper')
575
- .then(() => {
576
- Cypress.vueWrapper.vm.updatePosition()
577
- })
578
-
579
- cy.dataCy('menu')
580
- .checkVerticalPosition('wrapper', 'bottom', 'bottom')
581
-
582
- cy.dataCy('menu')
583
- .checkHorizontalPosition('wrapper', 'left', 'left')
584
- })
585
- })
586
- })
587
-
588
- describe('(method): focus', () => {
589
- it('should focus the menu', () => {
590
- cy.mount(WrapperOne, {
591
- props: {
592
- 'no-focus': true
593
- }
594
- })
595
-
596
- cy.dataCy('wrapper')
597
- .click()
598
- cy.dataCy('menu')
599
- .should('exist')
600
- .should('not.have.focus')
601
- cy.dataCy('wrapper')
602
- .then(() => {
603
- // Need to call method from wrapper
604
- // Click a button closes the menu
605
- Cypress.vueWrapper.vm.focusMethod()
606
- })
607
- cy.dataCy('menu')
608
- .should('have.focus')
609
- })
610
-
611
- it('should focus the autofocus element inside the menu', () => {
612
- cy.mount(WrapperTwo, {
613
- props: {
614
- 'no-focus': true
615
- }
616
- })
617
-
618
- cy.dataCy('wrapper')
619
- .click()
620
- cy.dataCy('menu')
621
- .should('exist')
622
- .should('not.have.focus')
623
- cy.dataCy('wrapper')
624
- .then(() => {
625
- // Need to call method from wrapper
626
- // Click a button closes the menu
627
- Cypress.vueWrapper.vm.focusMethod()
628
- })
629
- cy.dataCy('input-2')
630
- .should('have.focus')
631
- })
632
- })
633
- })
634
- })
@@ -1,51 +0,0 @@
1
- <template>
2
- <div style="margin: 150px auto" class="row justify-center">
3
- <q-btn color="primary" data-cy="wrapper" label="Wrapper" style="width: 100px;">
4
- <q-menu v-bind="$attrs" data-cy="menu" ref="menuRef">
5
- <q-list style="min-width: 120px">
6
- <q-item clickable v-close-popup data-cy="close-popup">
7
- <q-item-section>VClosePopup</q-item-section>
8
- </q-item>
9
- <q-item clickable data-cy="keep-open">
10
- <q-item-section>KeepOpen</q-item-section>
11
- </q-item>
12
- </q-list>
13
- </q-menu>
14
- </q-btn>
15
- </div>
16
- <div data-cy="other-target" class="col-12 other-target bg-red q-pa-lg text-white">Other target</div>
17
- <q-btn class="hidden" data-cy="method-show" @click="show"/>
18
- <q-btn class="hidden" data-cy="method-hide" @click="hide"/>
19
- <q-btn class="hidden" data-cy="method-toggle" @click="toggle"/>
20
- <q-btn class="hidden" data-cy="method-focus" @click="focusMethod"/>
21
- </template>
22
-
23
- <script>
24
- import { defineComponent, ref } from 'vue'
25
-
26
- export default defineComponent({
27
- inheritAttrs: false,
28
- setup () {
29
- const menuRef = ref(null)
30
-
31
- function show () {
32
- menuRef.value.show()
33
- }
34
-
35
- function hide () {
36
- menuRef.value.hide()
37
- }
38
-
39
- function toggle () {
40
- menuRef.value.toggle()
41
- }
42
-
43
- function focusMethod () {
44
- menuRef.value.focus()
45
- }
46
-
47
- return { menuRef, show, hide, toggle, focusMethod }
48
- }
49
- })
50
-
51
- </script>