@dimailn/vuetify 2.7.2-alpha28 → 2.7.2-alpha29
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/vuetify.js +1416 -304
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +1 -1
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VAlert/VAlert.js +38 -8
- package/es5/components/VAlert/VAlert.js.map +1 -1
- package/es5/components/VAutocomplete/VAutocomplete.js +1 -0
- package/es5/components/VAutocomplete/VAutocomplete.js.map +1 -1
- package/es5/components/VBadge/VBadge.js +28 -0
- package/es5/components/VBadge/VBadge.js.map +1 -1
- package/es5/components/VBanner/VBanner.js +34 -6
- package/es5/components/VBanner/VBanner.js.map +1 -1
- package/es5/components/VBottomNavigation/VBottomNavigation.js +25 -0
- package/es5/components/VBottomNavigation/VBottomNavigation.js.map +1 -1
- package/es5/components/VCarousel/VCarousel.js +28 -3
- package/es5/components/VCarousel/VCarousel.js.map +1 -1
- package/es5/components/VCheckbox/VSimpleCheckbox.js +30 -2
- package/es5/components/VCheckbox/VSimpleCheckbox.js.map +1 -1
- package/es5/components/VColorPicker/VColorPicker.js +30 -2
- package/es5/components/VColorPicker/VColorPicker.js.map +1 -1
- package/es5/components/VCombobox/VCombobox.js +1 -0
- package/es5/components/VCombobox/VCombobox.js.map +1 -1
- package/es5/components/VDataIterator/VDataFooter.js +16 -7
- package/es5/components/VDataIterator/VDataFooter.js.map +1 -1
- package/es5/components/VDataIterator/VDataIterator.js +42 -47
- package/es5/components/VDataIterator/VDataIterator.js.map +1 -1
- package/es5/components/VDataTable/RowGroup.js +46 -15
- package/es5/components/VDataTable/RowGroup.js.map +1 -1
- package/es5/components/VDataTable/VDataTable.js +10 -18
- package/es5/components/VDataTable/VDataTable.js.map +1 -1
- package/es5/components/VDataTable/VDataTableHeader.js.map +1 -1
- package/es5/components/VDataTable/VDataTableHeaderDesktop.js +3 -0
- package/es5/components/VDataTable/VDataTableHeaderDesktop.js.map +1 -1
- package/es5/components/VDataTable/VDataTableHeaderMobile.js +28 -37
- package/es5/components/VDataTable/VDataTableHeaderMobile.js.map +1 -1
- package/es5/components/VDataTable/VEditDialog.js +3 -4
- package/es5/components/VDataTable/VEditDialog.js.map +1 -1
- package/es5/components/VDataTable/VSimpleTable.js +1 -1
- package/es5/components/VDataTable/VSimpleTable.js.map +1 -1
- package/es5/components/VDataTable/VVirtualTable.js +5 -5
- package/es5/components/VDataTable/VVirtualTable.js.map +1 -1
- package/es5/components/VDataTable/mixins/header.js +1 -1
- package/es5/components/VDataTable/mixins/header.js.map +1 -1
- package/es5/components/VDatePicker/VDatePicker.js +21 -9
- package/es5/components/VDatePicker/VDatePicker.js.map +1 -1
- package/es5/components/VDatePicker/VDatePickerHeader.js +24 -8
- package/es5/components/VDatePicker/VDatePickerHeader.js.map +1 -1
- package/es5/components/VDatePicker/VDatePickerTitle.js +33 -8
- package/es5/components/VDatePicker/VDatePickerTitle.js.map +1 -1
- package/es5/components/VDatePicker/VDatePickerYears.js +38 -13
- package/es5/components/VDatePicker/VDatePickerYears.js.map +1 -1
- package/es5/components/VDatePicker/mixins/date-picker-table.js +33 -17
- package/es5/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
- package/es5/components/VInput/VInput.js +36 -8
- package/es5/components/VInput/VInput.js.map +1 -1
- package/es5/components/VList/VListGroup.js +47 -21
- package/es5/components/VList/VListGroup.js.map +1 -1
- package/es5/components/VList/VListItem.js +29 -4
- package/es5/components/VList/VListItem.js.map +1 -1
- package/es5/components/VMenu/VMenu.js +55 -30
- package/es5/components/VMenu/VMenu.js.map +1 -1
- package/es5/components/VMessages/VMessages.js +30 -7
- package/es5/components/VMessages/VMessages.js.map +1 -1
- package/es5/components/VNavigationDrawer/VNavigationDrawer.js +36 -9
- package/es5/components/VNavigationDrawer/VNavigationDrawer.js.map +1 -1
- package/es5/components/VOverlay/VOverlay.js +28 -0
- package/es5/components/VOverlay/VOverlay.js.map +1 -1
- package/es5/components/VPagination/VPagination.js +30 -6
- package/es5/components/VPagination/VPagination.js.map +1 -1
- package/es5/components/VProgressLinear/VProgressLinear.js +28 -0
- package/es5/components/VProgressLinear/VProgressLinear.js.map +1 -1
- package/es5/components/VRadioGroup/VRadioGroup.js +28 -0
- package/es5/components/VRadioGroup/VRadioGroup.js.map +1 -1
- package/es5/components/VRating/VRating.js +45 -17
- package/es5/components/VRating/VRating.js.map +1 -1
- package/es5/components/VSelect/VSelect.js +112 -84
- package/es5/components/VSelect/VSelect.js.map +1 -1
- package/es5/components/VSelect/VSelectList.js +58 -17
- package/es5/components/VSelect/VSelectList.js.map +1 -1
- package/es5/components/VSlider/VSlider.js +42 -16
- package/es5/components/VSlider/VSlider.js.map +1 -1
- package/es5/components/VSpeedDial/VSpeedDial.js +10 -8
- package/es5/components/VSpeedDial/VSpeedDial.js.map +1 -1
- package/es5/components/VTabs/VTabs.js +45 -17
- package/es5/components/VTabs/VTabs.js.map +1 -1
- package/es5/framework.js +1 -1
- package/es5/mixins/validatable/index.js +24 -0
- package/es5/mixins/validatable/index.js.map +1 -1
- package/es5/util/console.js +49 -18
- package/es5/util/console.js.map +1 -1
- package/es5/util/helpers.js +5 -1
- package/es5/util/helpers.js.map +1 -1
- package/lib/components/VAlert/VAlert.js +12 -6
- package/lib/components/VAlert/VAlert.js.map +1 -1
- package/lib/components/VAutocomplete/VAutocomplete.js +1 -0
- package/lib/components/VAutocomplete/VAutocomplete.js.map +1 -1
- package/lib/components/VBadge/VBadge.js +11 -0
- package/lib/components/VBadge/VBadge.js.map +1 -1
- package/lib/components/VBanner/VBanner.js +11 -0
- package/lib/components/VBanner/VBanner.js.map +1 -1
- package/lib/components/VBottomNavigation/VBottomNavigation.js +7 -0
- package/lib/components/VBottomNavigation/VBottomNavigation.js.map +1 -1
- package/lib/components/VCarousel/VCarousel.js +7 -0
- package/lib/components/VCarousel/VCarousel.js.map +1 -1
- package/lib/components/VCheckbox/VSimpleCheckbox.js +11 -0
- package/lib/components/VCheckbox/VSimpleCheckbox.js.map +1 -1
- package/lib/components/VColorPicker/VColorPicker.js +12 -1
- package/lib/components/VColorPicker/VColorPicker.js.map +1 -1
- package/lib/components/VCombobox/VCombobox.js +1 -0
- package/lib/components/VCombobox/VCombobox.js.map +1 -1
- package/lib/components/VDataIterator/VDataFooter.js +14 -7
- package/lib/components/VDataIterator/VDataFooter.js.map +1 -1
- package/lib/components/VDataIterator/VDataIterator.js +26 -31
- package/lib/components/VDataIterator/VDataIterator.js.map +1 -1
- package/lib/components/VDataTable/RowGroup.js +30 -14
- package/lib/components/VDataTable/RowGroup.js.map +1 -1
- package/lib/components/VDataTable/VDataTable.js +8 -15
- package/lib/components/VDataTable/VDataTable.js.map +1 -1
- package/lib/components/VDataTable/VDataTableHeader.js +1 -1
- package/lib/components/VDataTable/VDataTableHeader.js.map +1 -1
- package/lib/components/VDataTable/VDataTableHeaderDesktop.js +3 -0
- package/lib/components/VDataTable/VDataTableHeaderDesktop.js.map +1 -1
- package/lib/components/VDataTable/VDataTableHeaderMobile.js +17 -25
- package/lib/components/VDataTable/VDataTableHeaderMobile.js.map +1 -1
- package/lib/components/VDataTable/VEditDialog.js +3 -4
- package/lib/components/VDataTable/VEditDialog.js.map +1 -1
- package/lib/components/VDataTable/VSimpleTable.js +1 -1
- package/lib/components/VDataTable/VSimpleTable.js.map +1 -1
- package/lib/components/VDataTable/VVirtualTable.js +1 -2
- package/lib/components/VDataTable/VVirtualTable.js.map +1 -1
- package/lib/components/VDataTable/mixins/header.js +1 -1
- package/lib/components/VDataTable/mixins/header.js.map +1 -1
- package/lib/components/VDatePicker/VDatePicker.js +7 -1
- package/lib/components/VDatePicker/VDatePicker.js.map +1 -1
- package/lib/components/VDatePicker/VDatePickerHeader.js +12 -1
- package/lib/components/VDatePicker/VDatePickerHeader.js.map +1 -1
- package/lib/components/VDatePicker/VDatePickerTitle.js +11 -0
- package/lib/components/VDatePicker/VDatePickerTitle.js.map +1 -1
- package/lib/components/VDatePicker/VDatePickerYears.js +11 -1
- package/lib/components/VDatePicker/VDatePickerYears.js.map +1 -1
- package/lib/components/VDatePicker/mixins/date-picker-table.js +12 -1
- package/lib/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
- package/lib/components/VInput/VInput.js +13 -3
- package/lib/components/VInput/VInput.js.map +1 -1
- package/lib/components/VList/VListGroup.js +16 -8
- package/lib/components/VList/VListGroup.js.map +1 -1
- package/lib/components/VList/VListItem.js +8 -1
- package/lib/components/VList/VListItem.js.map +1 -1
- package/lib/components/VMenu/VMenu.js +14 -3
- package/lib/components/VMenu/VMenu.js.map +1 -1
- package/lib/components/VMessages/VMessages.js +13 -2
- package/lib/components/VMessages/VMessages.js.map +1 -1
- package/lib/components/VNavigationDrawer/VNavigationDrawer.js +11 -2
- package/lib/components/VNavigationDrawer/VNavigationDrawer.js.map +1 -1
- package/lib/components/VOverlay/VOverlay.js +11 -0
- package/lib/components/VOverlay/VOverlay.js.map +1 -1
- package/lib/components/VPagination/VPagination.js +11 -0
- package/lib/components/VPagination/VPagination.js.map +1 -1
- package/lib/components/VProgressLinear/VProgressLinear.js +11 -0
- package/lib/components/VProgressLinear/VProgressLinear.js.map +1 -1
- package/lib/components/VRadioGroup/VRadioGroup.js +11 -0
- package/lib/components/VRadioGroup/VRadioGroup.js.map +1 -1
- package/lib/components/VRating/VRating.js +11 -0
- package/lib/components/VRating/VRating.js.map +1 -1
- package/lib/components/VSelect/VSelect.js +52 -36
- package/lib/components/VSelect/VSelect.js.map +1 -1
- package/lib/components/VSelect/VSelectList.js +21 -3
- package/lib/components/VSelect/VSelectList.js.map +1 -1
- package/lib/components/VSlider/VSlider.js +11 -1
- package/lib/components/VSlider/VSlider.js.map +1 -1
- package/lib/components/VSpeedDial/VSpeedDial.js +7 -7
- package/lib/components/VSpeedDial/VSpeedDial.js.map +1 -1
- package/lib/components/VTabs/VTabs.js +11 -0
- package/lib/components/VTabs/VTabs.js.map +1 -1
- package/lib/framework.js +1 -1
- package/lib/mixins/validatable/index.js +7 -1
- package/lib/mixins/validatable/index.js.map +1 -1
- package/lib/util/console.js +47 -17
- package/lib/util/console.js.map +1 -1
- package/lib/util/helpers.js +5 -1
- package/lib/util/helpers.js.map +1 -1
- package/package.json +1 -1
- package/src/components/VAlert/VAlert.ts +17 -7
- package/src/components/VAlert/__tests__/VAlert.spec.ts +78 -50
- package/src/components/VAlert/__tests__/__snapshots__/VAlert.spec.ts.snap +16 -18
- package/src/components/VAutocomplete/VAutocomplete.ts +22 -0
- package/src/components/VAutocomplete/__tests__/VAutocomplete.spec.ts +51 -53
- package/src/components/VAutocomplete/__tests__/VAutocomplete2.spec.ts +77 -48
- package/src/components/VAutocomplete/__tests__/VAutocomplete3.spec.ts +101 -39
- package/src/components/VBadge/VBadge.ts +13 -0
- package/src/components/VBanner/VBanner.ts +13 -0
- package/src/components/VBottomNavigation/VBottomNavigation.ts +10 -0
- package/src/components/VCarousel/VCarousel.ts +11 -0
- package/src/components/VCheckbox/VSimpleCheckbox.ts +13 -0
- package/src/components/VColorPicker/VColorPicker.ts +13 -0
- package/src/components/VCombobox/VCombobox.ts +23 -0
- package/src/components/VCombobox/__tests__/VCombobox-multiple.spec.ts +118 -110
- package/src/components/VCombobox/__tests__/VCombobox.spec.ts +119 -93
- package/src/components/VDataIterator/VDataFooter.ts +14 -9
- package/src/components/VDataIterator/VDataIterator.ts +46 -34
- package/src/components/VDataIterator/__tests__/VDataFooter.spec.ts +38 -39
- package/src/components/VDataIterator/__tests__/VDataIterator.spec.ts +90 -122
- package/src/components/VDataIterator/__tests__/__snapshots__/VDataFooter.spec.ts.snap +92 -82
- package/src/components/VDataIterator/__tests__/__snapshots__/VDataIterator.spec.ts.snap +79 -69
- package/src/components/VDataTable/RowGroup.ts +33 -16
- package/src/components/VDataTable/VDataTable.ts +8 -15
- package/src/components/VDataTable/VDataTableHeader.ts +2 -2
- package/src/components/VDataTable/VDataTableHeaderDesktop.ts +4 -0
- package/src/components/VDataTable/VDataTableHeaderMobile.ts +16 -25
- package/src/components/VDataTable/VEditDialog.ts +3 -3
- package/src/components/VDataTable/VSimpleTable.ts +2 -3
- package/src/components/VDataTable/VVirtualTable.ts +1 -2
- package/src/components/VDataTable/__tests__/VDataTable.spec.ts +18 -22
- package/src/components/VDataTable/__tests__/VDataTableHeader.spec.ts +39 -29
- package/src/components/VDataTable/__tests__/VEditDialog.spec.ts +7 -2
- package/src/components/VDataTable/__tests__/VSimpleTable.spec.ts +11 -16
- package/src/components/VDataTable/__tests__/__snapshots__/VDataTable.spec.ts.snap +2543 -2086
- package/src/components/VDataTable/__tests__/__snapshots__/VDataTableHeader.spec.ts.snap +115 -144
- package/src/components/VDataTable/__tests__/__snapshots__/VEditDialog.spec.ts.snap +4 -12
- package/src/components/VDataTable/__tests__/__snapshots__/VSimpleTable.spec.ts.snap +22 -18
- package/src/components/VDataTable/mixins/__tests__/__snapshots__/header.spec.ts.snap +9 -12
- package/src/components/VDataTable/mixins/__tests__/header.spec.ts +15 -15
- package/src/components/VDataTable/mixins/header.ts +1 -1
- package/src/components/VDatePicker/VDatePicker.ts +11 -1
- package/src/components/VDatePicker/VDatePickerHeader.ts +13 -0
- package/src/components/VDatePicker/VDatePickerTitle.ts +12 -0
- package/src/components/VDatePicker/VDatePickerYears.ts +13 -0
- package/src/components/VDatePicker/mixins/date-picker-table.ts +13 -0
- package/src/components/VInput/VInput.ts +18 -5
- package/src/components/VList/VListGroup.ts +22 -10
- package/src/components/VList/VListItem.ts +10 -1
- package/src/components/VMenu/VMenu.ts +21 -3
- package/src/components/VMenu/__tests__/VMenu.spec.ts +90 -69
- package/src/components/VMenu/__tests__/__snapshots__/VMenu.spec.ts.snap +3 -5
- package/src/components/VMessages/VMessages.ts +15 -4
- package/src/components/VMessages/__tests__/VMessages.spec.ts +43 -5
- package/src/components/VMessages/__tests__/__snapshots__/VMessages.spec.ts.snap +16 -25
- package/src/components/VNavigationDrawer/VNavigationDrawer.ts +21 -11
- package/src/components/VOverlay/VOverlay.ts +12 -0
- package/src/components/VPagination/VPagination.ts +23 -9
- package/src/components/VProgressLinear/VProgressLinear.ts +13 -0
- package/src/components/VRadioGroup/VRadioGroup.ts +14 -0
- package/src/components/VRating/VRating.ts +13 -0
- package/src/components/VSelect/VSelect.ts +60 -43
- package/src/components/VSelect/VSelectList.ts +29 -8
- package/src/components/VSlider/VSlider.ts +14 -1
- package/src/components/VSpeedDial/VSpeedDial.ts +7 -8
- package/src/components/VSpeedDial/__tests__/VSpeedDial.spec.ts +21 -13
- package/src/components/VSpeedDial/__tests__/__snapshots__/VSpeedDial.spec.ts.snap +6 -6
- package/src/components/VTabs/VTabs.ts +14 -0
- package/src/mixins/validatable/index.ts +11 -1
- package/src/util/__tests__/console.spec.ts +124 -11
- package/src/util/__tests__/helpers.spec.ts +59 -31
- package/src/util/console.ts +43 -24
- package/src/util/helpers.ts +8 -4
|
@@ -1,40 +1,36 @@
|
|
|
1
|
+
import { h } from 'vue'
|
|
1
2
|
import VDataFooter from '../VDataFooter'
|
|
2
3
|
import { Lang } from '../../../services/lang'
|
|
3
4
|
import {
|
|
4
5
|
mount,
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
MountingOptions,
|
|
7
|
+
VueWrapper,
|
|
8
|
+
enableAutoUnmount,
|
|
7
9
|
} from '@vue/test-utils'
|
|
8
|
-
import Vue from 'vue'
|
|
9
10
|
import { preset } from '../../../presets/default'
|
|
10
11
|
|
|
11
|
-
Vue.prototype.$vuetify = {
|
|
12
|
-
icons: {
|
|
13
|
-
values: {
|
|
14
|
-
prev: 'mdi-chevron-left',
|
|
15
|
-
next: 'mdi-chevron-right',
|
|
16
|
-
dropdown: 'mdi-menu-down',
|
|
17
|
-
first: 'mdi-page-first',
|
|
18
|
-
last: 'mdi-page-last',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
|
|
23
12
|
describe('VDataFooter.ts', () => {
|
|
24
13
|
type Instance = InstanceType<typeof VDataFooter>
|
|
25
|
-
let mountFunction: (options?:
|
|
14
|
+
let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
|
|
15
|
+
|
|
16
|
+
// Включаем автоматическое размонтирование после каждого теста
|
|
17
|
+
enableAutoUnmount(afterEach)
|
|
18
|
+
|
|
26
19
|
beforeEach(() => {
|
|
27
20
|
document.body.setAttribute('data-app', '')
|
|
28
21
|
|
|
29
|
-
mountFunction = (options?:
|
|
22
|
+
mountFunction = (options?: MountingOptions<Instance>) => {
|
|
30
23
|
return mount(VDataFooter, {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
global: {
|
|
25
|
+
mocks: {
|
|
26
|
+
$vuetify: {
|
|
27
|
+
icons: {
|
|
28
|
+
component: null,
|
|
29
|
+
},
|
|
30
|
+
lang: new Lang(preset),
|
|
31
|
+
theme: {
|
|
32
|
+
dark: false,
|
|
33
|
+
},
|
|
38
34
|
},
|
|
39
35
|
},
|
|
40
36
|
},
|
|
@@ -45,7 +41,7 @@ describe('VDataFooter.ts', () => {
|
|
|
45
41
|
|
|
46
42
|
it('should render with custom itemsPerPage', () => {
|
|
47
43
|
const wrapper = mountFunction({
|
|
48
|
-
|
|
44
|
+
props: {
|
|
49
45
|
itemsPerPageOptions: [50, 100],
|
|
50
46
|
options: {
|
|
51
47
|
page: 4,
|
|
@@ -67,7 +63,7 @@ describe('VDataFooter.ts', () => {
|
|
|
67
63
|
|
|
68
64
|
it('should render in RTL mode', () => {
|
|
69
65
|
const wrapper = mountFunction({
|
|
70
|
-
|
|
66
|
+
props: {
|
|
71
67
|
options: {
|
|
72
68
|
page: 4,
|
|
73
69
|
itemsPerPage: 10,
|
|
@@ -82,12 +78,17 @@ describe('VDataFooter.ts', () => {
|
|
|
82
78
|
},
|
|
83
79
|
showFirstLastPage: true,
|
|
84
80
|
},
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
global: {
|
|
82
|
+
mocks: {
|
|
83
|
+
$vuetify: {
|
|
84
|
+
rtl: true,
|
|
85
|
+
icons: {
|
|
86
|
+
component: null,
|
|
87
|
+
},
|
|
88
|
+
lang: new Lang(preset),
|
|
89
|
+
theme: {
|
|
90
|
+
dark: false,
|
|
91
|
+
},
|
|
91
92
|
},
|
|
92
93
|
},
|
|
93
94
|
},
|
|
@@ -98,7 +99,7 @@ describe('VDataFooter.ts', () => {
|
|
|
98
99
|
|
|
99
100
|
it('should render first & last icons with showFirstLastPage', () => {
|
|
100
101
|
const wrapper = mountFunction({
|
|
101
|
-
|
|
102
|
+
props: {
|
|
102
103
|
options: {
|
|
103
104
|
page: 4,
|
|
104
105
|
itemsPerPage: 10,
|
|
@@ -122,7 +123,7 @@ describe('VDataFooter.ts', () => {
|
|
|
122
123
|
const mock = jest.fn()
|
|
123
124
|
|
|
124
125
|
const wrapper = mountFunction({
|
|
125
|
-
|
|
126
|
+
props: {
|
|
126
127
|
options: {
|
|
127
128
|
page: 4,
|
|
128
129
|
itemsPerPage: 10,
|
|
@@ -135,9 +136,7 @@ describe('VDataFooter.ts', () => {
|
|
|
135
136
|
pageCount: 10,
|
|
136
137
|
itemsLength: 100,
|
|
137
138
|
},
|
|
138
|
-
|
|
139
|
-
listeners: {
|
|
140
|
-
'update:options': mock,
|
|
139
|
+
'onUpdate:options': mock,
|
|
141
140
|
},
|
|
142
141
|
})
|
|
143
142
|
|
|
@@ -157,7 +156,7 @@ describe('VDataFooter.ts', () => {
|
|
|
157
156
|
|
|
158
157
|
it('should show current page if has showCurrentPage', () => {
|
|
159
158
|
const wrapper = mountFunction({
|
|
160
|
-
|
|
159
|
+
props: {
|
|
161
160
|
options: {
|
|
162
161
|
page: 4,
|
|
163
162
|
itemsPerPage: 10,
|
|
@@ -179,7 +178,7 @@ describe('VDataFooter.ts', () => {
|
|
|
179
178
|
|
|
180
179
|
it('should disable last page button if no items', () => {
|
|
181
180
|
const wrapper = mountFunction({
|
|
182
|
-
|
|
181
|
+
props: {
|
|
183
182
|
options: {
|
|
184
183
|
page: 1,
|
|
185
184
|
itemsPerPage: 10,
|
|
@@ -1,44 +1,41 @@
|
|
|
1
|
+
import { h } from 'vue'
|
|
1
2
|
import VDataIterator from '../VDataIterator'
|
|
2
3
|
import { Lang } from '../../../services/lang'
|
|
3
4
|
import {
|
|
4
5
|
mount,
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
MountingOptions,
|
|
7
|
+
VueWrapper,
|
|
8
|
+
enableAutoUnmount,
|
|
7
9
|
} from '@vue/test-utils'
|
|
8
|
-
import Vue from 'vue'
|
|
9
10
|
import { Breakpoint } from '../../../services/breakpoint'
|
|
10
11
|
import { preset } from '../../../presets/default'
|
|
11
12
|
|
|
12
|
-
Vue.prototype.$vuetify = {
|
|
13
|
-
icons: {
|
|
14
|
-
values: {
|
|
15
|
-
prev: 'mdi-chevron-left',
|
|
16
|
-
next: 'mdi-chevron-right',
|
|
17
|
-
dropdown: 'mdi-menu-down',
|
|
18
|
-
first: 'mdi-page-first',
|
|
19
|
-
last: 'mdi-page-last',
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
}
|
|
23
|
-
|
|
24
13
|
describe('VDataIterator.ts', () => {
|
|
25
14
|
type Instance = InstanceType<typeof VDataIterator>
|
|
26
|
-
let mountFunction: (options?:
|
|
15
|
+
let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
|
|
16
|
+
|
|
17
|
+
// Включаем автоматическое размонтирование после каждого теста
|
|
18
|
+
enableAutoUnmount(afterEach)
|
|
19
|
+
|
|
27
20
|
beforeEach(() => {
|
|
28
21
|
document.body.setAttribute('data-app', '')
|
|
29
22
|
|
|
30
|
-
mountFunction = (options?:
|
|
23
|
+
mountFunction = (options?: MountingOptions<Instance>) => {
|
|
31
24
|
return mount(VDataIterator, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
25
|
+
global: {
|
|
26
|
+
mocks: {
|
|
27
|
+
$vuetify: {
|
|
28
|
+
breakpoint: new Breakpoint(preset),
|
|
29
|
+
lang: new Lang(preset),
|
|
30
|
+
theme: {
|
|
31
|
+
dark: false,
|
|
32
|
+
},
|
|
33
|
+
icons: {
|
|
34
|
+
component: null,
|
|
35
|
+
},
|
|
38
36
|
},
|
|
39
37
|
},
|
|
40
38
|
},
|
|
41
|
-
sync: false,
|
|
42
39
|
...options,
|
|
43
40
|
})
|
|
44
41
|
}
|
|
@@ -52,7 +49,7 @@ describe('VDataIterator.ts', () => {
|
|
|
52
49
|
|
|
53
50
|
it('should render and match snapshot with data', () => {
|
|
54
51
|
const wrapper = mountFunction({
|
|
55
|
-
|
|
52
|
+
props: {
|
|
56
53
|
items: [
|
|
57
54
|
'foo',
|
|
58
55
|
'bar',
|
|
@@ -60,7 +57,7 @@ describe('VDataIterator.ts', () => {
|
|
|
60
57
|
'qux',
|
|
61
58
|
],
|
|
62
59
|
},
|
|
63
|
-
|
|
60
|
+
slots: {
|
|
64
61
|
item (props) {
|
|
65
62
|
return h('div', [props.item])
|
|
66
63
|
},
|
|
@@ -72,7 +69,7 @@ describe('VDataIterator.ts', () => {
|
|
|
72
69
|
|
|
73
70
|
it('should render valid no-data, loading and no-results states', async () => {
|
|
74
71
|
const wrapper = mountFunction({
|
|
75
|
-
|
|
72
|
+
props: {
|
|
76
73
|
items: [],
|
|
77
74
|
serverItemsLength: 0,
|
|
78
75
|
},
|
|
@@ -81,7 +78,7 @@ describe('VDataIterator.ts', () => {
|
|
|
81
78
|
await wrapper.vm.$nextTick()
|
|
82
79
|
expect(wrapper.html()).toMatchSnapshot()
|
|
83
80
|
|
|
84
|
-
wrapper.setProps({
|
|
81
|
+
await wrapper.setProps({
|
|
85
82
|
loading: true,
|
|
86
83
|
items: [],
|
|
87
84
|
})
|
|
@@ -89,7 +86,7 @@ describe('VDataIterator.ts', () => {
|
|
|
89
86
|
|
|
90
87
|
expect(wrapper.html()).toMatchSnapshot()
|
|
91
88
|
|
|
92
|
-
wrapper.setProps({
|
|
89
|
+
await wrapper.setProps({
|
|
93
90
|
loading: false,
|
|
94
91
|
items: ['foo'],
|
|
95
92
|
search: 'something',
|
|
@@ -100,166 +97,141 @@ describe('VDataIterator.ts', () => {
|
|
|
100
97
|
})
|
|
101
98
|
|
|
102
99
|
it('should emit when selection happens', async () => {
|
|
103
|
-
const input = jest.fn()
|
|
104
100
|
const wrapper = mountFunction({
|
|
105
|
-
|
|
101
|
+
props: {
|
|
106
102
|
itemKey: 'id',
|
|
107
103
|
items: [
|
|
108
104
|
{ id: 1, text: 'foo' },
|
|
109
105
|
{ id: 2, text: 'bar' },
|
|
110
106
|
],
|
|
111
107
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return h('div', {
|
|
118
|
-
attrs: {
|
|
119
|
-
id: props.item.text,
|
|
120
|
-
},
|
|
121
|
-
on: {
|
|
122
|
-
click: () => props.select(true),
|
|
123
|
-
},
|
|
124
|
-
}, [props.item.text])
|
|
125
|
-
},
|
|
108
|
+
slots: {
|
|
109
|
+
item: (props: any) => h('div', {
|
|
110
|
+
id: props.item.text,
|
|
111
|
+
onClick: () => props.select(true),
|
|
112
|
+
}, [props.item.text]),
|
|
126
113
|
},
|
|
127
114
|
})
|
|
128
115
|
|
|
116
|
+
await wrapper.vm.$nextTick()
|
|
117
|
+
|
|
129
118
|
const foo = wrapper.find('#foo')
|
|
130
|
-
foo.
|
|
119
|
+
expect(foo.exists()).toBe(true)
|
|
120
|
+
await foo.trigger('click')
|
|
131
121
|
|
|
132
122
|
await wrapper.vm.$nextTick()
|
|
133
123
|
|
|
134
|
-
expect(
|
|
124
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
125
|
+
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([[{ id: 1, text: 'foo' }]])
|
|
135
126
|
})
|
|
136
127
|
|
|
137
128
|
it('should emit when expansion happens', async () => {
|
|
138
|
-
const input = jest.fn()
|
|
139
129
|
const wrapper = mountFunction({
|
|
140
|
-
|
|
130
|
+
props: {
|
|
141
131
|
itemKey: 'id',
|
|
142
132
|
items: [
|
|
143
133
|
{ id: 1, text: 'foo' },
|
|
144
134
|
{ id: 2, text: 'bar' },
|
|
145
135
|
],
|
|
146
136
|
},
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return h('div', {
|
|
153
|
-
attrs: {
|
|
154
|
-
id: props.item.text,
|
|
155
|
-
},
|
|
156
|
-
on: {
|
|
157
|
-
click: () => props.expand(true),
|
|
158
|
-
},
|
|
159
|
-
}, [props.item.text])
|
|
160
|
-
},
|
|
137
|
+
slots: {
|
|
138
|
+
item: (props: any) => h('div', {
|
|
139
|
+
id: props.item.text,
|
|
140
|
+
onClick: () => props.expand(true),
|
|
141
|
+
}, [props.item.text]),
|
|
161
142
|
},
|
|
162
143
|
})
|
|
163
144
|
|
|
164
|
-
|
|
165
|
-
|
|
145
|
+
await wrapper.vm.$nextTick()
|
|
146
|
+
|
|
147
|
+
const bar = wrapper.find('#bar')
|
|
148
|
+
expect(bar.exists()).toBe(true)
|
|
149
|
+
await bar.trigger('click')
|
|
166
150
|
|
|
167
151
|
await wrapper.vm.$nextTick()
|
|
168
152
|
|
|
169
|
-
expect(
|
|
153
|
+
expect(wrapper.emitted('update:expanded')).toBeTruthy()
|
|
154
|
+
expect(wrapper.emitted('update:expanded')?.[0]).toEqual([[{ id: 2, text: 'bar' }]])
|
|
170
155
|
})
|
|
171
156
|
|
|
172
157
|
it('should select all', async () => {
|
|
173
|
-
const input = jest.fn()
|
|
174
158
|
const items = [
|
|
175
159
|
{ id: 'foo' },
|
|
176
160
|
{ id: 'bar' },
|
|
177
161
|
]
|
|
178
|
-
const toggleSelectAll = jest.fn()
|
|
179
162
|
|
|
180
163
|
const wrapper = mountFunction({
|
|
181
|
-
|
|
164
|
+
props: {
|
|
182
165
|
items,
|
|
183
166
|
},
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
header (props) {
|
|
190
|
-
return h('div', {
|
|
191
|
-
attrs: {
|
|
192
|
-
id: 'header',
|
|
193
|
-
},
|
|
194
|
-
on: {
|
|
195
|
-
click: () => props.toggleSelectAll(true),
|
|
196
|
-
},
|
|
197
|
-
})
|
|
198
|
-
},
|
|
167
|
+
slots: {
|
|
168
|
+
header: (props: any) => h('div', {
|
|
169
|
+
id: 'header',
|
|
170
|
+
onClick: () => props.toggleSelectAll(true),
|
|
171
|
+
}),
|
|
199
172
|
},
|
|
200
173
|
})
|
|
201
174
|
|
|
175
|
+
await wrapper.vm.$nextTick()
|
|
176
|
+
|
|
202
177
|
const header = wrapper.find('#header')
|
|
203
|
-
header.
|
|
178
|
+
expect(header.exists()).toBe(true)
|
|
179
|
+
await header.trigger('click')
|
|
204
180
|
|
|
205
181
|
await wrapper.vm.$nextTick()
|
|
206
182
|
|
|
207
|
-
expect(
|
|
208
|
-
expect(
|
|
183
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
184
|
+
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([items])
|
|
185
|
+
expect(wrapper.emitted('toggle-select-all')).toBeTruthy()
|
|
186
|
+
expect(wrapper.emitted('toggle-select-all')?.[0]).toEqual([{ items, value: true }])
|
|
209
187
|
})
|
|
210
188
|
|
|
211
189
|
it('should update expansion from the outside', async () => {
|
|
212
|
-
const mock = jest.fn()
|
|
213
190
|
const wrapper = mountFunction({
|
|
214
|
-
|
|
191
|
+
props: {
|
|
215
192
|
items: [
|
|
216
193
|
{ id: 'foo' },
|
|
217
194
|
{ id: 'bar' },
|
|
218
195
|
],
|
|
219
196
|
},
|
|
220
|
-
listeners: {
|
|
221
|
-
'update:expanded': mock,
|
|
222
|
-
},
|
|
223
197
|
})
|
|
224
198
|
|
|
225
|
-
wrapper.setProps({
|
|
199
|
+
await wrapper.setProps({
|
|
226
200
|
expanded: [{ id: 'foo' }],
|
|
227
201
|
})
|
|
228
202
|
await wrapper.vm.$nextTick()
|
|
229
|
-
expect(
|
|
203
|
+
expect(wrapper.emitted('update:expanded')).toBeTruthy()
|
|
204
|
+
expect(wrapper.emitted('update:expanded')?.slice(-1)[0]).toEqual([[{ id: 'foo' }]])
|
|
230
205
|
|
|
231
|
-
wrapper.setProps({
|
|
206
|
+
await wrapper.setProps({
|
|
232
207
|
expanded: [{ id: 'bar' }],
|
|
233
208
|
})
|
|
234
209
|
await wrapper.vm.$nextTick()
|
|
235
|
-
expect(
|
|
210
|
+
expect(wrapper.emitted('update:expanded')?.slice(-1)[0]).toEqual([[{ id: 'bar' }]])
|
|
236
211
|
})
|
|
237
212
|
|
|
238
213
|
it('should update selection from the outside', async () => {
|
|
239
|
-
const mock = jest.fn()
|
|
240
214
|
const wrapper = mountFunction({
|
|
241
|
-
|
|
215
|
+
props: {
|
|
242
216
|
items: [
|
|
243
217
|
{ id: 'foo' },
|
|
244
218
|
{ id: 'bar' },
|
|
245
219
|
],
|
|
246
220
|
},
|
|
247
|
-
listeners: {
|
|
248
|
-
input: mock,
|
|
249
|
-
},
|
|
250
221
|
})
|
|
251
222
|
|
|
252
|
-
wrapper.setProps({
|
|
253
|
-
|
|
223
|
+
await wrapper.setProps({
|
|
224
|
+
modelValue: [{ id: 'foo' }],
|
|
254
225
|
})
|
|
255
226
|
await wrapper.vm.$nextTick()
|
|
256
|
-
expect(
|
|
227
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
228
|
+
expect(wrapper.emitted('update:modelValue')?.slice(-1)[0]).toEqual([[{ id: 'foo' }]])
|
|
257
229
|
|
|
258
|
-
wrapper.setProps({
|
|
259
|
-
|
|
230
|
+
await wrapper.setProps({
|
|
231
|
+
modelValue: [{ id: 'bar' }],
|
|
260
232
|
})
|
|
261
233
|
await wrapper.vm.$nextTick()
|
|
262
|
-
expect(
|
|
234
|
+
expect(wrapper.emitted('update:modelValue')?.slice(-1)[0]).toEqual([[{ id: 'bar' }]])
|
|
263
235
|
})
|
|
264
236
|
|
|
265
237
|
it('should check if all items are selected', async () => {
|
|
@@ -269,16 +241,16 @@ describe('VDataIterator.ts', () => {
|
|
|
269
241
|
]
|
|
270
242
|
|
|
271
243
|
const wrapper = mountFunction({
|
|
272
|
-
|
|
244
|
+
props: {
|
|
273
245
|
items,
|
|
274
246
|
},
|
|
275
|
-
|
|
247
|
+
slots: {
|
|
276
248
|
header: render,
|
|
277
249
|
},
|
|
278
250
|
})
|
|
279
251
|
|
|
280
|
-
wrapper.setProps({
|
|
281
|
-
|
|
252
|
+
await wrapper.setProps({
|
|
253
|
+
modelValue: items,
|
|
282
254
|
})
|
|
283
255
|
await wrapper.vm.$nextTick()
|
|
284
256
|
|
|
@@ -295,16 +267,16 @@ describe('VDataIterator.ts', () => {
|
|
|
295
267
|
]
|
|
296
268
|
|
|
297
269
|
const wrapper = mountFunction({
|
|
298
|
-
|
|
270
|
+
props: {
|
|
299
271
|
items,
|
|
300
272
|
},
|
|
301
|
-
|
|
273
|
+
slots: {
|
|
302
274
|
header: render,
|
|
303
275
|
},
|
|
304
276
|
})
|
|
305
277
|
|
|
306
|
-
wrapper.setProps({
|
|
307
|
-
|
|
278
|
+
await wrapper.setProps({
|
|
279
|
+
modelValue: items.slice(1),
|
|
308
280
|
})
|
|
309
281
|
await wrapper.vm.$nextTick()
|
|
310
282
|
|
|
@@ -316,7 +288,7 @@ describe('VDataIterator.ts', () => {
|
|
|
316
288
|
|
|
317
289
|
it('should hide footer', () => {
|
|
318
290
|
const wrapper = mountFunction({
|
|
319
|
-
|
|
291
|
+
props: {
|
|
320
292
|
hideDefaultFooter: true,
|
|
321
293
|
},
|
|
322
294
|
})
|
|
@@ -326,9 +298,8 @@ describe('VDataIterator.ts', () => {
|
|
|
326
298
|
|
|
327
299
|
// https://github.com/vuetifyjs/vuetify/issues/8886
|
|
328
300
|
it('should emit page-count event', async () => {
|
|
329
|
-
const pageCount = jest.fn()
|
|
330
301
|
const wrapper = mountFunction({
|
|
331
|
-
|
|
302
|
+
props: {
|
|
332
303
|
items: [
|
|
333
304
|
'foo',
|
|
334
305
|
'bar',
|
|
@@ -337,12 +308,9 @@ describe('VDataIterator.ts', () => {
|
|
|
337
308
|
],
|
|
338
309
|
itemsPerPage: 1,
|
|
339
310
|
},
|
|
340
|
-
listeners: {
|
|
341
|
-
pageCount,
|
|
342
|
-
},
|
|
343
311
|
})
|
|
344
312
|
|
|
345
|
-
wrapper.setProps({ itemsPerPage: 4 })
|
|
313
|
+
await wrapper.setProps({ itemsPerPage: 4 })
|
|
346
314
|
await wrapper.vm.$nextTick()
|
|
347
315
|
|
|
348
316
|
expect(wrapper.emitted('page-count')).toEqual([[4], [1]])
|