quasar 2.9.2 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/Dialog.json +25 -68
- package/dist/api/Intersection.json +25 -100
- package/dist/api/Loading.json +5 -20
- package/dist/api/LoadingBar.json +1 -7
- package/dist/api/LocalStorage.json +4 -16
- package/dist/api/Morph.json +2 -14
- package/dist/api/Notify.json +0 -3
- package/dist/api/Platform.json +1 -4
- package/dist/api/QAjaxBar.json +1 -11
- package/dist/api/QBreadcrumbs.json +0 -8
- package/dist/api/QBreadcrumbsEl.json +0 -14
- package/dist/api/QBtn.json +0 -3
- package/dist/api/QBtnDropdown.json +32 -8
- package/dist/api/QCarousel.json +0 -10
- package/dist/api/QCarouselControl.json +0 -3
- package/dist/api/QCircularProgress.json +0 -23
- package/dist/api/QColor.json +0 -3
- package/dist/api/QDialog.json +18 -9
- package/dist/api/QDrawer.json +0 -6
- package/dist/api/QExpansionItem.json +0 -3
- package/dist/api/QFab.json +1 -6
- package/dist/api/QFabAction.json +1 -3
- package/dist/api/QField.json +1 -6
- package/dist/api/QFile.json +12 -29
- package/dist/api/QFooter.json +0 -3
- package/dist/api/QHeader.json +0 -6
- package/dist/api/QInfiniteScroll.json +9 -16
- package/dist/api/QInnerLoading.json +0 -4
- package/dist/api/QInput.json +8 -15
- package/dist/api/QIntersection.json +0 -4
- package/dist/api/QItemLabel.json +0 -5
- package/dist/api/QKnob.json +3 -36
- package/dist/api/QLayout.json +6 -24
- package/dist/api/QLinearProgress.json +0 -6
- package/dist/api/QList.json +15 -0
- package/dist/api/QMenu.json +7 -12
- package/dist/api/QOptionGroup.json +0 -3
- package/dist/api/QPage.json +2 -8
- package/dist/api/QPageScroller.json +0 -9
- package/dist/api/QPageSticky.json +0 -3
- package/dist/api/QPagination.json +138 -127
- package/dist/api/QParallax.json +2 -14
- package/dist/api/QPopupEdit.json +0 -8
- package/dist/api/QPopupProxy.json +0 -4
- package/dist/api/QRange.json +5 -32
- package/dist/api/QRating.json +0 -4
- package/dist/api/QResizeObserver.json +2 -8
- package/dist/api/QScrollArea.json +8 -36
- package/dist/api/QScrollObserver.json +6 -24
- package/dist/api/QSelect.json +18 -108
- package/dist/api/QSlideItem.json +1 -6
- package/dist/api/QSlideTransition.json +0 -4
- package/dist/api/QSlider.json +3 -24
- package/dist/api/QSpinner.json +0 -4
- package/dist/api/QSplitter.json +1 -4
- package/dist/api/QStepper.json +0 -7
- package/dist/api/QTabPanels.json +0 -7
- package/dist/api/QTable.json +43 -191
- package/dist/api/QTabs.json +1 -7
- package/dist/api/QTime.json +3 -12
- package/dist/api/QTooltip.json +7 -18
- package/dist/api/QTree.json +0 -3
- package/dist/api/QUploader.json +5 -16
- package/dist/api/QVirtualScroll.json +11 -56
- package/dist/api/Screen.json +9 -36
- package/dist/api/Scroll.json +2 -8
- package/dist/api/SessionStorage.json +4 -16
- package/dist/api/TouchHold.json +3 -12
- package/dist/api/TouchPan.json +7 -28
- package/dist/api/TouchRepeat.json +6 -24
- package/dist/api/TouchSwipe.json +3 -12
- package/dist/icon-set/bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v6-pro.umd.prod.js +1 -1
- package/dist/icon-set/fontawesome-v6.umd.prod.js +1 -1
- package/dist/icon-set/ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/material-icons.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-outlined.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-rounded.umd.prod.js +1 -1
- package/dist/icon-set/material-symbols-sharp.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v3.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v4.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v5.umd.prod.js +1 -1
- package/dist/icon-set/mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-bootstrap-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-eva-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-fontawesome-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v4.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v5.umd.prod.js +1 -1
- package/dist/icon-set/svg-ionicons-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-line-awesome.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-round.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-icons.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-outlined.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-rounded.umd.prod.js +1 -1
- package/dist/icon-set/svg-material-symbols-sharp.umd.prod.js +1 -1
- package/dist/icon-set/svg-mdi-v6.umd.prod.js +1 -1
- package/dist/icon-set/svg-themify.umd.prod.js +1 -1
- package/dist/icon-set/themify.umd.prod.js +1 -1
- package/dist/lang/ar-TN.umd.prod.js +1 -1
- package/dist/lang/ar.umd.prod.js +1 -1
- package/dist/lang/az-Latn.umd.prod.js +1 -1
- package/dist/lang/bg.umd.prod.js +1 -1
- package/dist/lang/bn.umd.prod.js +1 -1
- package/dist/lang/ca.umd.prod.js +1 -1
- package/dist/lang/cs.umd.prod.js +1 -1
- package/dist/lang/da.umd.prod.js +1 -1
- package/dist/lang/de.umd.prod.js +1 -1
- package/dist/lang/el.umd.prod.js +1 -1
- package/dist/lang/en-GB.umd.prod.js +1 -1
- package/dist/lang/en-US.umd.prod.js +1 -1
- package/dist/lang/eo.umd.prod.js +1 -1
- package/dist/lang/es.umd.prod.js +1 -1
- package/dist/lang/et.umd.prod.js +1 -1
- package/dist/lang/eu.umd.prod.js +1 -1
- package/dist/lang/fa-IR.umd.prod.js +1 -1
- package/dist/lang/fa.umd.prod.js +1 -1
- package/dist/lang/fi.umd.prod.js +1 -1
- package/dist/lang/fr.umd.prod.js +1 -1
- package/dist/lang/gn.umd.prod.js +1 -1
- package/dist/lang/he.umd.prod.js +1 -1
- package/dist/lang/hr.umd.prod.js +1 -1
- package/dist/lang/hu.umd.prod.js +1 -1
- package/dist/lang/id.umd.prod.js +1 -1
- package/dist/lang/is.umd.prod.js +1 -1
- package/dist/lang/it.umd.prod.js +1 -1
- package/dist/lang/ja.umd.prod.js +1 -1
- package/dist/lang/km.umd.prod.js +1 -1
- package/dist/lang/ko-KR.umd.prod.js +1 -1
- package/dist/lang/kur-CKB.umd.prod.js +1 -1
- package/dist/lang/kz.umd.prod.js +1 -1
- package/dist/lang/lt.umd.prod.js +1 -1
- package/dist/lang/lu.umd.prod.js +1 -1
- package/dist/lang/lv.umd.prod.js +1 -1
- package/dist/lang/ml.umd.prod.js +1 -1
- package/dist/lang/mm.umd.prod.js +1 -1
- package/dist/lang/ms.umd.prod.js +1 -1
- package/dist/lang/my.umd.prod.js +1 -1
- package/dist/lang/nb-NO.umd.prod.js +1 -1
- package/dist/lang/nl.umd.prod.js +1 -1
- package/dist/lang/pl.umd.prod.js +1 -1
- package/dist/lang/pt-BR.umd.prod.js +1 -1
- package/dist/lang/pt.umd.prod.js +1 -1
- package/dist/lang/ro.umd.prod.js +1 -1
- package/dist/lang/ru.umd.prod.js +1 -1
- package/dist/lang/sk.umd.prod.js +1 -1
- package/dist/lang/sl.umd.prod.js +1 -1
- package/dist/lang/sm.umd.prod.js +1 -1
- package/dist/lang/sr-CYR.umd.prod.js +1 -1
- package/dist/lang/sr.umd.prod.js +1 -1
- package/dist/lang/sv.umd.prod.js +1 -1
- package/dist/lang/ta.umd.prod.js +1 -1
- package/dist/lang/th.umd.prod.js +1 -1
- package/dist/lang/tr.umd.prod.js +1 -1
- package/dist/lang/ug.umd.prod.js +1 -1
- package/dist/lang/uk.umd.prod.js +1 -1
- package/dist/lang/uz-Cyrl.umd.prod.js +1 -1
- package/dist/lang/uz-Latn.umd.prod.js +1 -1
- package/dist/lang/vi.umd.prod.js +1 -1
- package/dist/lang/zh-CN.umd.prod.js +1 -1
- package/dist/lang/zh-TW.umd.prod.js +1 -1
- package/dist/quasar.cjs.prod.js +2 -2
- package/dist/quasar.css +12 -2
- package/dist/quasar.esm.js +603 -445
- package/dist/quasar.esm.prod.js +2 -2
- package/dist/quasar.prod.css +1 -1
- package/dist/quasar.rtl.css +28 -2
- package/dist/quasar.rtl.prod.css +1 -1
- package/dist/quasar.sass +13 -3
- package/dist/quasar.umd.js +603 -445
- package/dist/quasar.umd.prod.js +2 -2
- package/dist/transforms/auto-import.json +7 -3
- package/dist/transforms/import-map.json +2 -0
- package/dist/types/index.d.ts +116 -106
- package/dist/vetur/quasar-attributes.json +65 -49
- package/dist/vetur/quasar-tags.json +18 -14
- package/dist/web-types/web-types.json +261 -222
- package/package.json +3 -3
- package/src/api.extends.json +1 -2
- package/src/components/ajax-bar/QAjaxBar.json +5 -11
- package/src/components/badge/QBadge.js +1 -1
- package/src/components/breadcrumbs/QBreadcrumbs.json +0 -2
- package/src/components/breadcrumbs/QBreadcrumbsEl.json +1 -6
- package/src/components/breadcrumbs/__tests__/BasicBreadcrumbs.vue +7 -0
- package/src/components/breadcrumbs/__tests__/BreadcrumbWithSeparatorSlot.vue +11 -0
- package/src/components/breadcrumbs/__tests__/QBreadcrumbs.spec.js +112 -0
- package/src/components/breadcrumbs/__tests__/QBreadcrumbsEl.spec.js +87 -0
- package/src/components/btn/QBtn.json +1 -3
- package/src/components/btn/__tests__/QBtn.spec.js +87 -14
- package/src/components/btn/__tests__/use-btn.spec.js +385 -58
- package/src/components/btn/use-btn.js +24 -14
- package/src/components/btn-dropdown/QBtnDropdown.js +34 -18
- package/src/components/btn-dropdown/QBtnDropdown.json +1 -3
- package/src/components/btn-toggle/QBtnToggle.js +14 -14
- package/src/components/btn-toggle/QBtnToggle.json +2 -4
- package/src/components/carousel/QCarousel.json +4 -9
- package/src/components/carousel/QCarouselControl.json +0 -1
- package/src/components/checkbox/use-checkbox.js +1 -1
- package/src/components/checkbox/use-checkbox.json +1 -2
- package/src/components/chip/QChip.js +14 -11
- package/src/components/circular-progress/QCircularProgress.json +0 -5
- package/src/components/color/QColor.json +0 -1
- package/src/components/date/QDate.js +3 -3
- package/src/components/date/QDate.json +28 -56
- package/src/components/dialog/QDialog.js +32 -41
- package/src/components/dialog/QDialog.json +9 -2
- package/src/components/dialog-bottom-sheet/BottomSheet.js +7 -4
- package/src/components/dialog-plugin/DialogPlugin.js +4 -4
- package/src/components/drawer/QDrawer.js +10 -8
- package/src/components/drawer/QDrawer.json +0 -4
- package/src/components/editor/QEditor.json +3 -6
- package/src/components/expansion-item/QExpansionItem.js +3 -3
- package/src/components/expansion-item/QExpansionItem.json +3 -8
- package/src/components/fab/QFab.json +0 -1
- package/src/components/fab/use-fab.json +0 -1
- package/src/components/field/QField.json +0 -1
- package/src/components/file/QFile.js +4 -1
- package/src/components/file/QFile.json +19 -20
- package/src/components/footer/QFooter.js +5 -3
- package/src/components/footer/QFooter.json +0 -1
- package/src/components/form/QForm.js +5 -3
- package/src/components/form/QForm.json +2 -4
- package/src/components/header/QHeader.js +5 -3
- package/src/components/header/QHeader.json +0 -4
- package/src/components/infinite-scroll/QInfiniteScroll.json +9 -6
- package/src/components/inner-loading/QInnerLoading.js +2 -5
- package/src/components/input/QInput.js +4 -1
- package/src/components/input/QInput.json +11 -7
- package/src/components/input/use-mask.js +2 -2
- package/src/components/intersection/QIntersection.json +0 -1
- package/src/components/item/QItem.js +1 -0
- package/src/components/item/QItem.json +1 -2
- package/src/components/item/QItemLabel.json +0 -1
- package/src/components/item/QList.js +7 -2
- package/src/components/item/QList.json +7 -0
- package/src/components/knob/QKnob.js +3 -3
- package/src/components/knob/QKnob.json +3 -12
- package/src/components/layout/QLayout.js +1 -1
- package/src/components/layout/QLayout.json +6 -12
- package/src/components/linear-progress/QLinearProgress.json +0 -2
- package/src/components/menu/QMenu.js +8 -5
- package/src/components/menu/QMenu.json +0 -2
- package/src/components/option-group/QOptionGroup.js +1 -1
- package/src/components/option-group/QOptionGroup.json +2 -5
- package/src/components/page/QPage.js +11 -4
- package/src/components/page/QPage.json +3 -6
- package/src/components/page/QPageContainer.js +5 -3
- package/src/components/page-scroller/QPageScroller.json +0 -2
- package/src/components/page-sticky/QPageSticky.json +0 -1
- package/src/components/page-sticky/use-page-sticky.js +5 -3
- package/src/components/pagination/QPagination.js +265 -188
- package/src/components/pagination/QPagination.json +87 -78
- package/src/components/pagination/QPagination.sass +14 -0
- package/src/components/parallax/QParallax.json +2 -6
- package/src/components/popup-edit/QPopupEdit.js +3 -3
- package/src/components/popup-edit/QPopupEdit.json +4 -10
- package/src/components/popup-proxy/QPopupProxy.json +0 -1
- package/src/components/radio/QRadio.json +1 -2
- package/src/components/range/QRange.json +2 -4
- package/src/components/rating/QRating.json +0 -1
- package/src/components/resize-observer/QResizeObserver.js +14 -10
- package/src/components/resize-observer/QResizeObserver.json +2 -4
- package/src/components/scroll-area/QScrollArea.js +15 -4
- package/src/components/scroll-area/QScrollArea.json +24 -50
- package/src/components/scroll-observer/QScrollObserver.js +2 -0
- package/src/components/scroll-observer/QScrollObserver.json +6 -12
- package/src/components/select/QSelect.js +20 -24
- package/src/components/select/QSelect.json +30 -65
- package/src/components/select/QSelect.sass +2 -2
- package/src/components/slide-item/QSlideItem.json +1 -2
- package/src/components/slide-transition/QSlideTransition.json +0 -1
- package/src/components/slider/use-slider.json +33 -70
- package/src/components/spinner/QSpinner.json +0 -1
- package/src/components/splitter/QSplitter.json +1 -2
- package/src/components/stepper/QStep.js +7 -5
- package/src/components/tab-panels/QTabPanel.js +1 -1
- package/src/components/table/QTable.js +3 -3
- package/src/components/table/QTable.json +118 -239
- package/src/components/tabs/QRouteTab.json +0 -1
- package/src/components/tabs/QTabs.js +0 -7
- package/src/components/tabs/QTabs.json +1 -3
- package/src/components/tabs/use-tab.js +5 -3
- package/src/components/time/QTime.json +10 -20
- package/src/components/timeline/QTimelineEntry.js +5 -3
- package/src/components/toolbar/QToolbar.js +1 -1
- package/src/components/tooltip/QTooltip.js +3 -6
- package/src/components/tooltip/QTooltip.json +0 -4
- package/src/components/tree/QTree.js +6 -6
- package/src/components/tree/QTree.json +15 -31
- package/src/components/uploader/QUploader.json +13 -22
- package/src/components/uploader/QUploaderAddTrigger.js +7 -3
- package/src/components/uploader/xhr-uploader-plugin.js +1 -1
- package/src/components/uploader/xhr-uploader-plugin.json +25 -50
- package/src/components/virtual-scroll/QVirtualScroll.json +5 -10
- package/src/components/virtual-scroll/use-virtual-scroll.js +1 -1
- package/src/components/virtual-scroll/use-virtual-scroll.json +8 -19
- package/src/composables/private/use-field.js +1 -1
- package/src/composables/private/use-field.json +2 -3
- package/src/composables/private/use-file.js +10 -1
- package/src/composables/private/use-file.json +4 -13
- package/src/composables/private/use-model-toggle.js +3 -3
- package/src/composables/private/use-panel.js +2 -2
- package/src/composables/private/use-panel.json +0 -2
- package/src/composables/private/use-portal.js +5 -1
- package/src/composables/private/use-portal.json +7 -1
- package/src/composables/private/use-transition.js +17 -11
- package/src/composables/private/use-transition.json +0 -1
- package/src/composables/private/use-validate.json +1 -3
- package/src/directives/Intersection.json +26 -53
- package/src/directives/Morph.json +4 -8
- package/src/directives/Mutation.json +6 -12
- package/src/directives/Scroll.json +2 -4
- package/src/directives/TouchHold.json +3 -6
- package/src/directives/TouchPan.json +7 -14
- package/src/directives/TouchRepeat.json +6 -12
- package/src/directives/TouchSwipe.json +3 -6
- package/src/plugins/BottomSheet.json +1 -2
- package/src/plugins/Cookies.json +2 -4
- package/src/plugins/Dialog.json +32 -72
- package/src/plugins/Loading.json +6 -11
- package/src/plugins/LoadingBar.json +3 -6
- package/src/plugins/Notify.json +4 -5
- package/src/plugins/Platform.json +3 -6
- package/src/plugins/Screen.json +9 -18
- package/src/utils/private/global-dialog.json +6 -12
- package/src/utils/private/portal.js +4 -4
- package/src/utils/private/symbols.js +2 -0
- package/src/utils/private/web-storage.json +6 -10
|
@@ -1,187 +1,514 @@
|
|
|
1
|
+
import { mount } from '@cypress/vue'
|
|
2
|
+
import { createMemoryHistory, createRouter } from 'vue-router'
|
|
3
|
+
import { alignMap, alignValues } from '../../../composables/private/use-align.js'
|
|
4
|
+
import QBtn from '../QBtn.js'
|
|
5
|
+
import { btnPadding as paddingMap } from '../use-btn.js'
|
|
6
|
+
|
|
7
|
+
const defaultOptions = {
|
|
8
|
+
label: 'simple Btn'
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const typesValues = [ 'button', 'submit', 'reset' ]
|
|
12
|
+
|
|
13
|
+
const paddingValues = Object.keys(paddingMap)
|
|
14
|
+
|
|
15
|
+
function mountQBtn (options = {}) {
|
|
16
|
+
// Setup options object
|
|
17
|
+
options.global = options.global || {}
|
|
18
|
+
options.global.plugins = options.global.plugins || []
|
|
19
|
+
|
|
20
|
+
options.props = {
|
|
21
|
+
...defaultOptions,
|
|
22
|
+
...options.props
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (!options.router) {
|
|
26
|
+
options.router = createRouter({
|
|
27
|
+
routes: [],
|
|
28
|
+
history: createMemoryHistory()
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Add router plugin
|
|
33
|
+
options.global.plugins.push({
|
|
34
|
+
install (app) {
|
|
35
|
+
app.use(options.router)
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return mount(QBtn, options)
|
|
40
|
+
}
|
|
41
|
+
|
|
1
42
|
describe('use-btn API', () => {
|
|
2
43
|
describe('Props', () => {
|
|
3
44
|
describe('Category: behavior|state', () => {
|
|
4
45
|
describe('(prop): loading', () => {
|
|
5
|
-
it
|
|
6
|
-
|
|
46
|
+
it('should render a button with "loading" slot when "loading" prop is set to true', () => {
|
|
47
|
+
mountQBtn({
|
|
48
|
+
props: {
|
|
49
|
+
loading: true
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
cy.get('.q-btn .q-spinner')
|
|
7
54
|
})
|
|
8
55
|
})
|
|
9
56
|
})
|
|
10
57
|
|
|
11
58
|
describe('Category: content', () => {
|
|
12
59
|
describe('(prop): label', () => {
|
|
13
|
-
it
|
|
14
|
-
|
|
60
|
+
it('should render a label inside the button', () => {
|
|
61
|
+
const label = 'Custom Label'
|
|
62
|
+
mountQBtn({
|
|
63
|
+
props: {
|
|
64
|
+
label
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
cy.get('.q-btn').should('contain', label)
|
|
15
69
|
})
|
|
16
70
|
})
|
|
17
71
|
|
|
18
72
|
describe('(prop): icon', () => {
|
|
19
|
-
it
|
|
20
|
-
|
|
73
|
+
it('should render an icon on the left', () => {
|
|
74
|
+
const icon = 'home'
|
|
75
|
+
|
|
76
|
+
mountQBtn({
|
|
77
|
+
props: {
|
|
78
|
+
icon
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
cy.get('.q-btn .on-left').should('contain', icon)
|
|
21
83
|
})
|
|
22
84
|
})
|
|
23
85
|
|
|
24
86
|
describe('(prop): icon-right', () => {
|
|
25
|
-
it
|
|
26
|
-
|
|
87
|
+
it('should render an icon on the right', () => {
|
|
88
|
+
const iconRight = 'home'
|
|
89
|
+
|
|
90
|
+
mountQBtn({
|
|
91
|
+
props: {
|
|
92
|
+
iconRight
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
cy.get('.q-btn .on-right').should('contain', iconRight)
|
|
27
97
|
})
|
|
28
98
|
})
|
|
29
99
|
|
|
30
100
|
describe('(prop): no-caps', () => {
|
|
31
|
-
it
|
|
32
|
-
|
|
101
|
+
it('should render a button with no uppercase text', () => {
|
|
102
|
+
mountQBtn({
|
|
103
|
+
props: {
|
|
104
|
+
noCaps: true
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
cy.get('.q-btn')
|
|
109
|
+
.should('have.class', 'q-btn--no-uppercase')
|
|
33
110
|
})
|
|
34
111
|
})
|
|
35
112
|
|
|
36
113
|
describe('(prop): no-wrap', () => {
|
|
37
|
-
it
|
|
38
|
-
|
|
114
|
+
it('should render a button with no wrapping text', () => {
|
|
115
|
+
mountQBtn({
|
|
116
|
+
props: {
|
|
117
|
+
noWrap: true
|
|
118
|
+
}
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
cy.get('.q-btn .q-btn__content')
|
|
122
|
+
.should('have.class', 'no-wrap')
|
|
123
|
+
.should('have.class', 'text-no-wrap')
|
|
39
124
|
})
|
|
40
125
|
})
|
|
41
126
|
|
|
42
127
|
describe('(prop): align', () => {
|
|
43
|
-
it.
|
|
44
|
-
|
|
128
|
+
it(`should render a badge aligned based on defined values: ${ alignValues.join(', ') }`, () => {
|
|
129
|
+
mountQBtn()
|
|
130
|
+
|
|
131
|
+
for (const align of alignValues) {
|
|
132
|
+
cy.get('.q-btn .q-btn__content')
|
|
133
|
+
.then(() => Cypress.vueWrapper.setProps({ align }))
|
|
134
|
+
.should('have.class', `justify-${ alignMap[ align ] }`)
|
|
135
|
+
}
|
|
45
136
|
})
|
|
46
137
|
})
|
|
47
138
|
|
|
48
139
|
describe('(prop): stack', () => {
|
|
49
|
-
it
|
|
50
|
-
|
|
140
|
+
it('should render a button with icon and label stacked vertically', () => {
|
|
141
|
+
mountQBtn({
|
|
142
|
+
props: {
|
|
143
|
+
stack: true
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
cy.get('.q-btn .q-btn__content')
|
|
148
|
+
.should('have.class', 'column')
|
|
51
149
|
})
|
|
52
150
|
})
|
|
53
151
|
|
|
54
152
|
describe('(prop): stretch', () => {
|
|
55
|
-
it
|
|
56
|
-
|
|
153
|
+
it('should render stretch height button when used in flexbox container', () => {
|
|
154
|
+
mountQBtn({
|
|
155
|
+
props: {
|
|
156
|
+
stretch: true
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
cy.get('.q-btn')
|
|
161
|
+
.should('have.class', 'no-border-radius')
|
|
162
|
+
.should('have.class', 'self-stretch')
|
|
57
163
|
})
|
|
58
164
|
})
|
|
59
165
|
})
|
|
60
166
|
|
|
61
167
|
describe('Category: general', () => {
|
|
62
168
|
describe('(prop): type', () => {
|
|
63
|
-
it.
|
|
64
|
-
|
|
169
|
+
it(`should render a button with a type based on defined values: ${ typesValues.join(', ') }`, () => {
|
|
170
|
+
mountQBtn()
|
|
171
|
+
|
|
172
|
+
for (const type of typesValues) {
|
|
173
|
+
cy.get('.q-btn')
|
|
174
|
+
.then(() => Cypress.vueWrapper.setProps({ type }))
|
|
175
|
+
.should('have.attr', 'type', type)
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
it('should render a component with <a> tag when "type" prop is set to "a"', () => {
|
|
180
|
+
mountQBtn({
|
|
181
|
+
props: {
|
|
182
|
+
type: 'a'
|
|
183
|
+
}
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
cy.get('.q-btn')
|
|
187
|
+
.should('have.prop', 'tagName').should('eq', 'A')
|
|
65
188
|
})
|
|
66
189
|
})
|
|
67
190
|
|
|
68
191
|
describe('(prop): tabindex', () => {
|
|
69
|
-
it
|
|
70
|
-
|
|
192
|
+
it('should set the tabindex', () => {
|
|
193
|
+
const tabindex = 1
|
|
194
|
+
|
|
195
|
+
mountQBtn({
|
|
196
|
+
props: {
|
|
197
|
+
tabindex
|
|
198
|
+
}
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
cy.get('.q-btn')
|
|
202
|
+
.should('have.attr', 'tabindex', tabindex)
|
|
71
203
|
})
|
|
72
204
|
})
|
|
73
205
|
})
|
|
74
206
|
|
|
75
207
|
describe('Category: navigation', () => {
|
|
76
208
|
describe('(prop): to', () => {
|
|
77
|
-
it
|
|
78
|
-
|
|
209
|
+
it('should render a component with <a> tag when "to" prop is set', () => {
|
|
210
|
+
const link = '/test'
|
|
211
|
+
|
|
212
|
+
mountQBtn({
|
|
213
|
+
props: {
|
|
214
|
+
to: link
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
cy.get('.q-btn')
|
|
219
|
+
.should('have.attr', 'href', link)
|
|
220
|
+
.should('have.prop', 'tagName').should('eq', 'A')
|
|
79
221
|
})
|
|
80
222
|
})
|
|
81
223
|
|
|
82
224
|
describe('(prop): replace', () => {
|
|
83
|
-
it
|
|
84
|
-
|
|
225
|
+
it('should render a component with <a> tag when "replace" prop is set', () => {
|
|
226
|
+
const link = '/test'
|
|
227
|
+
|
|
228
|
+
mountQBtn({
|
|
229
|
+
props: {
|
|
230
|
+
to: link,
|
|
231
|
+
replace: true
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
cy.get('.q-btn')
|
|
236
|
+
.should('have.attr', 'href', link)
|
|
237
|
+
.should('have.prop', 'tagName').should('eq', 'A')
|
|
85
238
|
})
|
|
86
239
|
})
|
|
87
240
|
|
|
88
241
|
describe('(prop): href', () => {
|
|
89
|
-
it
|
|
90
|
-
|
|
242
|
+
it('should render a component with <a> tag when "href" attribute is set', () => {
|
|
243
|
+
const href = 'https://quasar.dev'
|
|
244
|
+
|
|
245
|
+
mountQBtn({
|
|
246
|
+
props: {
|
|
247
|
+
href
|
|
248
|
+
}
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
cy.get('.q-btn')
|
|
252
|
+
.should('have.attr', 'href', href)
|
|
253
|
+
.should('have.prop', 'tagName').should('eq', 'A')
|
|
91
254
|
})
|
|
92
255
|
})
|
|
93
256
|
|
|
94
257
|
describe('(prop): target', () => {
|
|
95
|
-
it
|
|
96
|
-
|
|
258
|
+
it('should render a component with <a> tag when "href" and "target" attributes are set', () => {
|
|
259
|
+
const href = 'https://quasar.dev'
|
|
260
|
+
|
|
261
|
+
mountQBtn({
|
|
262
|
+
props: {
|
|
263
|
+
href,
|
|
264
|
+
target: '_blank'
|
|
265
|
+
}
|
|
266
|
+
})
|
|
267
|
+
|
|
268
|
+
cy.get('.q-btn')
|
|
269
|
+
.should('have.attr', 'target', '_blank')
|
|
270
|
+
.should('have.prop', 'tagName').should('eq', 'A')
|
|
97
271
|
})
|
|
98
272
|
})
|
|
99
273
|
})
|
|
100
274
|
|
|
101
275
|
describe('Category: state', () => {
|
|
102
276
|
describe('(prop): disable', () => {
|
|
103
|
-
it
|
|
104
|
-
|
|
277
|
+
it('should render a disabled button', () => {
|
|
278
|
+
mountQBtn({
|
|
279
|
+
props: {
|
|
280
|
+
disable: true
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
cy.get('.q-btn')
|
|
285
|
+
.should('have.class', 'disabled')
|
|
286
|
+
.should('have.attr', 'disabled')
|
|
105
287
|
})
|
|
106
288
|
})
|
|
107
289
|
})
|
|
108
290
|
|
|
109
291
|
describe('Category: style', () => {
|
|
110
292
|
describe('(prop): outline', () => {
|
|
111
|
-
it
|
|
112
|
-
|
|
293
|
+
it('should render a button with outline style', () => {
|
|
294
|
+
mountQBtn({
|
|
295
|
+
props: {
|
|
296
|
+
outline: true
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
cy.get('.q-btn')
|
|
301
|
+
.should('have.class', 'q-btn--outline')
|
|
113
302
|
})
|
|
114
303
|
})
|
|
115
304
|
|
|
116
305
|
describe('(prop): flat', () => {
|
|
117
|
-
it
|
|
118
|
-
|
|
306
|
+
it('should render a button with flat style', () => {
|
|
307
|
+
mountQBtn({
|
|
308
|
+
props: {
|
|
309
|
+
flat: true
|
|
310
|
+
}
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
cy.get('.q-btn')
|
|
314
|
+
.should('have.class', 'q-btn--flat')
|
|
119
315
|
})
|
|
120
316
|
})
|
|
121
317
|
|
|
122
318
|
describe('(prop): unelevated', () => {
|
|
123
|
-
it
|
|
124
|
-
|
|
319
|
+
it('should render a button with unelevated style', () => {
|
|
320
|
+
mountQBtn({
|
|
321
|
+
props: {
|
|
322
|
+
unelevated: true
|
|
323
|
+
}
|
|
324
|
+
})
|
|
325
|
+
|
|
326
|
+
cy.get('.q-btn')
|
|
327
|
+
.should('have.class', 'q-btn--unelevated')
|
|
125
328
|
})
|
|
126
329
|
})
|
|
127
330
|
|
|
128
331
|
describe('(prop): rounded', () => {
|
|
129
|
-
it
|
|
130
|
-
|
|
332
|
+
it('should render a button with rounded style', () => {
|
|
333
|
+
mountQBtn({
|
|
334
|
+
props: {
|
|
335
|
+
rounded: true
|
|
336
|
+
}
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
cy.get('.q-btn')
|
|
340
|
+
.should('have.class', 'q-btn--rounded')
|
|
131
341
|
})
|
|
132
342
|
})
|
|
133
343
|
|
|
134
344
|
describe('(prop): push', () => {
|
|
135
|
-
it
|
|
136
|
-
|
|
345
|
+
it('should render a button with push style', () => {
|
|
346
|
+
mountQBtn({
|
|
347
|
+
props: {
|
|
348
|
+
push: true
|
|
349
|
+
}
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
cy.get('.q-btn')
|
|
353
|
+
.should('have.class', 'q-btn--push')
|
|
354
|
+
})
|
|
355
|
+
})
|
|
356
|
+
|
|
357
|
+
describe('(prop): square', () => {
|
|
358
|
+
it('should render a button with square style', () => {
|
|
359
|
+
mountQBtn({
|
|
360
|
+
props: {
|
|
361
|
+
square: true
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
|
|
365
|
+
cy.get('.q-btn')
|
|
366
|
+
.should('have.class', 'q-btn--square')
|
|
137
367
|
})
|
|
138
368
|
})
|
|
139
369
|
|
|
140
370
|
describe('(prop): glossy', () => {
|
|
141
|
-
it
|
|
142
|
-
|
|
371
|
+
it('should render a button with glossy style', () => {
|
|
372
|
+
mountQBtn({
|
|
373
|
+
props: {
|
|
374
|
+
glossy: true
|
|
375
|
+
}
|
|
376
|
+
})
|
|
377
|
+
|
|
378
|
+
cy.get('.q-btn')
|
|
379
|
+
.should('have.class', 'glossy')
|
|
143
380
|
})
|
|
144
381
|
})
|
|
145
382
|
|
|
146
383
|
describe('(prop): fab', () => {
|
|
147
|
-
it
|
|
148
|
-
|
|
384
|
+
it('should render a button with fab style', () => {
|
|
385
|
+
mountQBtn({
|
|
386
|
+
props: {
|
|
387
|
+
fab: true
|
|
388
|
+
}
|
|
389
|
+
})
|
|
390
|
+
|
|
391
|
+
cy.get('.q-btn')
|
|
392
|
+
.should('have.class', 'q-btn--fab')
|
|
149
393
|
})
|
|
150
394
|
})
|
|
151
395
|
|
|
152
396
|
describe('(prop): fab-mini', () => {
|
|
153
|
-
it
|
|
154
|
-
|
|
397
|
+
it('should render a button with fab-mini style', () => {
|
|
398
|
+
mountQBtn({
|
|
399
|
+
props: {
|
|
400
|
+
fabMini: true
|
|
401
|
+
}
|
|
402
|
+
})
|
|
403
|
+
|
|
404
|
+
cy.get('.q-btn')
|
|
405
|
+
.should('have.class', 'q-btn--fab-mini')
|
|
155
406
|
})
|
|
156
407
|
})
|
|
157
408
|
|
|
158
409
|
describe('(prop): padding', () => {
|
|
159
|
-
it.
|
|
160
|
-
|
|
410
|
+
it(`should render a button with padding based on defined values: ${ paddingValues.join(', ') }`, () => {
|
|
411
|
+
mountQBtn()
|
|
412
|
+
|
|
413
|
+
for (const padding of paddingValues) {
|
|
414
|
+
cy.get('.q-btn')
|
|
415
|
+
.then(() => Cypress.vueWrapper.setProps({ padding }))
|
|
416
|
+
.should('have.css', 'padding', `${ paddingMap[ padding ] }px`)
|
|
417
|
+
}
|
|
418
|
+
})
|
|
419
|
+
|
|
420
|
+
it('should render a button with padding based custom value', () => {
|
|
421
|
+
const padding = '10px'
|
|
422
|
+
|
|
423
|
+
mountQBtn({
|
|
424
|
+
props: {
|
|
425
|
+
padding
|
|
426
|
+
}
|
|
427
|
+
})
|
|
428
|
+
|
|
429
|
+
cy.get('.q-btn')
|
|
430
|
+
.should('have.css', 'padding', padding)
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
it('should render a button with padding vertically and horizontally based on defined values" ', () => {
|
|
434
|
+
mountQBtn()
|
|
435
|
+
|
|
436
|
+
for (const paddingVertically of paddingValues) {
|
|
437
|
+
for (const paddingHorizontally of paddingValues) {
|
|
438
|
+
if (paddingVertically === paddingHorizontally) { continue }
|
|
439
|
+
|
|
440
|
+
const padding = `${ paddingVertically } ${ paddingHorizontally }`
|
|
441
|
+
|
|
442
|
+
cy.get('.q-btn')
|
|
443
|
+
.then(() => Cypress.vueWrapper.setProps({ padding }))
|
|
444
|
+
.should('have.css', 'padding',
|
|
445
|
+
`${ paddingMap[ paddingVertically ] }px ${ paddingMap[ paddingHorizontally ] }px`)
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
it('should render a button with "minWidth" and "minHeight" props set to "0"', () => {
|
|
451
|
+
mountQBtn({
|
|
452
|
+
props: {
|
|
453
|
+
padding: '0'
|
|
454
|
+
}
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
cy.get('.q-btn')
|
|
458
|
+
.should('have.css', 'min-width', '0px')
|
|
459
|
+
.should('have.css', 'min-height', '0px')
|
|
161
460
|
})
|
|
162
461
|
})
|
|
163
462
|
|
|
164
463
|
describe('(prop): color', () => {
|
|
165
|
-
it
|
|
166
|
-
|
|
464
|
+
it('should change text color based on Quasar Color Palette', () => {
|
|
465
|
+
const color = 'red'
|
|
466
|
+
|
|
467
|
+
mountQBtn({
|
|
468
|
+
props: { color }
|
|
469
|
+
})
|
|
470
|
+
|
|
471
|
+
cy.get('.q-btn')
|
|
472
|
+
.should('have.class', `bg-${ color }`)
|
|
167
473
|
})
|
|
168
474
|
})
|
|
169
475
|
|
|
170
476
|
describe('(prop): text-color', () => {
|
|
171
|
-
it
|
|
172
|
-
|
|
477
|
+
it('should change text color based on Quasar Color Palette', () => {
|
|
478
|
+
const textColor = 'red'
|
|
479
|
+
|
|
480
|
+
mountQBtn({
|
|
481
|
+
props: { textColor }
|
|
482
|
+
})
|
|
483
|
+
|
|
484
|
+
cy.get('.q-btn')
|
|
485
|
+
.should('have.class', `text-${ textColor }`)
|
|
173
486
|
})
|
|
174
487
|
})
|
|
175
488
|
|
|
176
489
|
describe('(prop): dense', () => {
|
|
177
|
-
it
|
|
178
|
-
|
|
490
|
+
it('should render a button with dense style', () => {
|
|
491
|
+
mountQBtn({
|
|
492
|
+
props: {
|
|
493
|
+
dense: true
|
|
494
|
+
}
|
|
495
|
+
})
|
|
496
|
+
|
|
497
|
+
cy.get('.q-btn')
|
|
498
|
+
.should('have.class', 'q-btn--dense')
|
|
179
499
|
})
|
|
180
500
|
})
|
|
181
501
|
|
|
182
502
|
describe('(prop): ripple', () => {
|
|
183
|
-
it
|
|
184
|
-
|
|
503
|
+
it('should render a button with ripple effect', () => {
|
|
504
|
+
mountQBtn({
|
|
505
|
+
props: {
|
|
506
|
+
ripple: true
|
|
507
|
+
}
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
cy.get('.q-btn')
|
|
511
|
+
.click().get('.q-ripple').should('exist')
|
|
185
512
|
})
|
|
186
513
|
})
|
|
187
514
|
})
|
|
@@ -4,7 +4,7 @@ import useAlign, { useAlignProps } from '../../composables/private/use-align.js'
|
|
|
4
4
|
import useSize, { useSizeProps } from '../../composables/private/use-size.js'
|
|
5
5
|
import useRouterLink, { useRouterLinkProps } from '../../composables/private/use-router-link.js'
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
export const btnPadding = {
|
|
8
8
|
none: 0,
|
|
9
9
|
xs: 4,
|
|
10
10
|
sm: 8,
|
|
@@ -24,6 +24,21 @@ const defaultSizes = {
|
|
|
24
24
|
const formTypes = [ 'button', 'submit', 'reset' ]
|
|
25
25
|
const mediaTypeRE = /[^\s]\/[^\s]/
|
|
26
26
|
|
|
27
|
+
export const btnDesignOptions = [ 'flat', 'outline', 'push', 'unelevated' ]
|
|
28
|
+
export const getBtnDesign = (props, defaultValue) => {
|
|
29
|
+
if (props.flat === true) return 'flat'
|
|
30
|
+
if (props.outline === true) return 'outline'
|
|
31
|
+
if (props.push === true) return 'push'
|
|
32
|
+
if (props.unelevated === true) return 'unelevated'
|
|
33
|
+
return defaultValue
|
|
34
|
+
}
|
|
35
|
+
export const getBtnDesignAttr = props => {
|
|
36
|
+
const design = getBtnDesign(props)
|
|
37
|
+
return design !== void 0
|
|
38
|
+
? { [ design ]: true }
|
|
39
|
+
: {}
|
|
40
|
+
}
|
|
41
|
+
|
|
27
42
|
export const useBtnProps = {
|
|
28
43
|
...useSizeProps,
|
|
29
44
|
...useRouterLinkProps,
|
|
@@ -37,13 +52,14 @@ export const useBtnProps = {
|
|
|
37
52
|
icon: String,
|
|
38
53
|
iconRight: String,
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
...btnDesignOptions.reduce(
|
|
56
|
+
(acc, val) => (acc[ val ] = Boolean) && acc,
|
|
57
|
+
{}
|
|
58
|
+
),
|
|
59
|
+
|
|
41
60
|
square: Boolean,
|
|
42
|
-
|
|
43
|
-
flat: Boolean,
|
|
44
|
-
unelevated: Boolean,
|
|
61
|
+
round: Boolean,
|
|
45
62
|
rounded: Boolean,
|
|
46
|
-
push: Boolean,
|
|
47
63
|
glossy: Boolean,
|
|
48
64
|
|
|
49
65
|
size: String,
|
|
@@ -93,7 +109,7 @@ export default function (props) {
|
|
|
93
109
|
? Object.assign({}, obj, {
|
|
94
110
|
padding: props.padding
|
|
95
111
|
.split(/\s+/)
|
|
96
|
-
.map(v => (v in
|
|
112
|
+
.map(v => (v in btnPadding ? btnPadding[ v ] + 'px' : v))
|
|
97
113
|
.join(' '),
|
|
98
114
|
minWidth: '0',
|
|
99
115
|
minHeight: '0'
|
|
@@ -113,13 +129,7 @@ export default function (props) {
|
|
|
113
129
|
isActionable.value === true ? props.tabindex || 0 : -1
|
|
114
130
|
))
|
|
115
131
|
|
|
116
|
-
const design = computed(() =>
|
|
117
|
-
if (props.flat === true) return 'flat'
|
|
118
|
-
if (props.outline === true) return 'outline'
|
|
119
|
-
if (props.push === true) return 'push'
|
|
120
|
-
if (props.unelevated === true) return 'unelevated'
|
|
121
|
-
return 'standard'
|
|
122
|
-
})
|
|
132
|
+
const design = computed(() => getBtnDesign(props, 'standard'))
|
|
123
133
|
|
|
124
134
|
const attributes = computed(() => {
|
|
125
135
|
const acc = { tabindex: tabIndex.value }
|