@dimailn/vuetify 2.7.2-alpha24 → 2.7.2-alpha26
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 +583 -388
- package/dist/vuetify.js.map +1 -1
- package/dist/vuetify.min.css +1 -1
- package/dist/vuetify.min.js +2 -2
- package/es5/components/VAppBar/VAppBarNavIcon.js +5 -1
- package/es5/components/VAppBar/VAppBarNavIcon.js.map +1 -1
- package/es5/components/VBanner/VBanner.js +15 -6
- package/es5/components/VBanner/VBanner.js.map +1 -1
- package/es5/components/VBreadcrumbs/VBreadcrumbs.js +18 -6
- package/es5/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
- package/es5/components/VBtn/VBtn.js +19 -15
- package/es5/components/VBtn/VBtn.js.map +1 -1
- package/es5/components/VCarousel/VCarousel.js +10 -4
- package/es5/components/VCarousel/VCarousel.js.map +1 -1
- package/es5/components/VCarousel/VCarouselItem.js +7 -3
- package/es5/components/VCarousel/VCarouselItem.js.map +1 -1
- package/es5/components/VCheckbox/VCheckbox.js +5 -1
- package/es5/components/VCheckbox/VCheckbox.js.map +1 -1
- package/es5/components/VColorPicker/VColorPicker.js +18 -31
- package/es5/components/VColorPicker/VColorPicker.js.map +1 -1
- package/es5/components/VColorPicker/VColorPickerCanvas.js +45 -46
- package/es5/components/VColorPicker/VColorPickerCanvas.js.map +1 -1
- package/es5/components/VColorPicker/VColorPickerEdit.js +27 -26
- package/es5/components/VColorPicker/VColorPickerEdit.js.map +1 -1
- package/es5/components/VColorPicker/VColorPickerPreview.js +41 -30
- package/es5/components/VColorPicker/VColorPickerPreview.js.map +1 -1
- package/es5/components/VColorPicker/VColorPickerSwatches.js +13 -10
- package/es5/components/VColorPicker/VColorPickerSwatches.js.map +1 -1
- package/es5/components/VDataIterator/VDataFooter.js +5 -1
- package/es5/components/VDataIterator/VDataFooter.js.map +1 -1
- package/es5/components/VDataTable/VDataTable.js +28 -18
- package/es5/components/VDataTable/VDataTable.js.map +1 -1
- package/es5/components/VDataTable/VDataTableHeader.js +2 -6
- package/es5/components/VDataTable/VDataTableHeader.js.map +1 -1
- package/es5/components/VDataTable/VEditDialog.js +6 -2
- package/es5/components/VDataTable/VEditDialog.js.map +1 -1
- package/es5/components/VDataTable/mixins/header.js +5 -1
- package/es5/components/VDataTable/mixins/header.js.map +1 -1
- package/es5/components/VDatePicker/VDatePickerHeader.js +8 -2
- package/es5/components/VDatePicker/VDatePickerHeader.js.map +1 -1
- package/es5/components/VDatePicker/VDatePickerTitle.js +13 -5
- package/es5/components/VDatePicker/VDatePickerTitle.js.map +1 -1
- package/es5/components/VDatePicker/mixins/date-picker-table.js +5 -3
- package/es5/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
- package/es5/components/VDialog/VDialog.js +16 -12
- package/es5/components/VDialog/VDialog.js.map +1 -1
- package/es5/components/VExpansionPanel/VExpansionPanelContent.js +11 -9
- package/es5/components/VExpansionPanel/VExpansionPanelContent.js.map +1 -1
- package/es5/components/VExpansionPanel/VExpansionPanelHeader.js +15 -9
- package/es5/components/VExpansionPanel/VExpansionPanelHeader.js.map +1 -1
- package/es5/components/VImg/VImg.js +6 -2
- package/es5/components/VImg/VImg.js.map +1 -1
- package/es5/components/VInput/VInput.js +28 -8
- package/es5/components/VInput/VInput.js.map +1 -1
- package/es5/components/VList/VListGroup.js +27 -9
- package/es5/components/VList/VListGroup.js.map +1 -1
- package/es5/components/VList/VListItem.js +5 -1
- package/es5/components/VList/VListItem.js.map +1 -1
- package/es5/components/VMessages/VMessages.js +5 -1
- package/es5/components/VMessages/VMessages.js.map +1 -1
- package/es5/components/VOverflowBtn/VOverflowBtn.js +3 -1
- package/es5/components/VOverflowBtn/VOverflowBtn.js.map +1 -1
- package/es5/components/VPagination/VPagination.js +3 -1
- package/es5/components/VPagination/VPagination.js.map +1 -1
- package/es5/components/VPicker/VPicker.js +5 -1
- package/es5/components/VPicker/VPicker.js.map +1 -1
- package/es5/components/VRadioGroup/VRadio.js +10 -2
- package/es5/components/VRadioGroup/VRadio.js.map +1 -1
- package/es5/components/VSelect/VSelect.js +6 -2
- package/es5/components/VSelect/VSelect.js.map +1 -1
- package/es5/components/VSelect/VSelectList.js +17 -9
- package/es5/components/VSelect/VSelectList.js.map +1 -1
- package/es5/components/VSlideGroup/VSlideGroup.js +26 -18
- package/es5/components/VSlideGroup/VSlideGroup.js.map +1 -1
- package/es5/components/VSlider/VSlider.js +36 -27
- package/es5/components/VSlider/VSlider.js.map +1 -1
- package/es5/components/VStepper/VStepperContent.js +3 -1
- package/es5/components/VStepper/VStepperContent.js.map +1 -1
- package/es5/components/VSwitch/VSwitch.js +10 -6
- package/es5/components/VSwitch/VSwitch.js.map +1 -1
- package/es5/components/VTabs/VTabs.js +6 -2
- package/es5/components/VTabs/VTabs.js.map +1 -1
- package/es5/components/VTextField/VTextField.js +7 -3
- package/es5/components/VTextField/VTextField.js.map +1 -1
- package/es5/components/VTooltip/VTooltip.js +6 -8
- package/es5/components/VTooltip/VTooltip.js.map +1 -1
- package/es5/components/VTreeview/VTreeviewNode.js +11 -3
- package/es5/components/VTreeview/VTreeviewNode.js.map +1 -1
- package/es5/components/transitions/createTransition.js +8 -2
- package/es5/components/transitions/createTransition.js.map +1 -1
- package/es5/framework.js +1 -1
- package/es5/mixins/picker/index.js +13 -3
- package/es5/mixins/picker/index.js.map +1 -1
- package/lib/components/VAppBar/VAppBarNavIcon.js +1 -1
- package/lib/components/VAppBar/VAppBarNavIcon.js.map +1 -1
- package/lib/components/VBanner/VBanner.js +3 -3
- package/lib/components/VBanner/VBanner.js.map +1 -1
- package/lib/components/VBreadcrumbs/VBreadcrumbs.js +2 -2
- package/lib/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
- package/lib/components/VBtn/VBtn.js +20 -19
- package/lib/components/VBtn/VBtn.js.map +1 -1
- package/lib/components/VCarousel/VCarousel.js +3 -3
- package/lib/components/VCarousel/VCarousel.js.map +1 -1
- package/lib/components/VCarousel/VCarouselItem.js +1 -1
- package/lib/components/VCarousel/VCarouselItem.js.map +1 -1
- package/lib/components/VCheckbox/VCheckbox.js +1 -1
- package/lib/components/VCheckbox/VCheckbox.js.map +1 -1
- package/lib/components/VColorPicker/VColorPicker.js +29 -37
- package/lib/components/VColorPicker/VColorPicker.js.map +1 -1
- package/lib/components/VColorPicker/VColorPickerCanvas.js +41 -43
- package/lib/components/VColorPicker/VColorPickerCanvas.js.map +1 -1
- package/lib/components/VColorPicker/VColorPickerEdit.js +25 -31
- package/lib/components/VColorPicker/VColorPickerEdit.js.map +1 -1
- package/lib/components/VColorPicker/VColorPickerPreview.js +45 -32
- package/lib/components/VColorPicker/VColorPickerPreview.js.map +1 -1
- package/lib/components/VColorPicker/VColorPickerSwatches.js +15 -9
- package/lib/components/VColorPicker/VColorPickerSwatches.js.map +1 -1
- package/lib/components/VDataIterator/VDataFooter.js +1 -1
- package/lib/components/VDataIterator/VDataFooter.js.map +1 -1
- package/lib/components/VDataTable/VDataTable.js +8 -9
- package/lib/components/VDataTable/VDataTable.js.map +1 -1
- package/lib/components/VDataTable/VDataTableHeader.js +3 -6
- package/lib/components/VDataTable/VDataTableHeader.js.map +1 -1
- package/lib/components/VDataTable/VEditDialog.js +2 -2
- package/lib/components/VDataTable/VEditDialog.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/VDatePickerHeader.js +2 -2
- package/lib/components/VDatePicker/VDatePickerHeader.js.map +1 -1
- package/lib/components/VDatePicker/VDatePickerTitle.js +2 -2
- package/lib/components/VDatePicker/VDatePickerTitle.js.map +1 -1
- package/lib/components/VDatePicker/mixins/date-picker-table.js +1 -1
- package/lib/components/VDatePicker/mixins/date-picker-table.js.map +1 -1
- package/lib/components/VDialog/VDialog.js +2 -2
- package/lib/components/VDialog/VDialog.js.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelContent.js +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelContent.js.map +1 -1
- package/lib/components/VExpansionPanel/VExpansionPanelHeader.js +2 -2
- package/lib/components/VExpansionPanel/VExpansionPanelHeader.js.map +1 -1
- package/lib/components/VImg/VImg.js +2 -2
- package/lib/components/VImg/VImg.js.map +1 -1
- package/lib/components/VInput/VInput.js +14 -6
- package/lib/components/VInput/VInput.js.map +1 -1
- package/lib/components/VList/VListGroup.js +5 -5
- package/lib/components/VList/VListGroup.js.map +1 -1
- package/lib/components/VList/VListItem.js +3 -1
- package/lib/components/VList/VListItem.js.map +1 -1
- package/lib/components/VMessages/VMessages.js +1 -1
- package/lib/components/VMessages/VMessages.js.map +1 -1
- package/lib/components/VOverflowBtn/VOverflowBtn.js +1 -1
- package/lib/components/VOverflowBtn/VOverflowBtn.js.map +1 -1
- package/lib/components/VPagination/VPagination.js +1 -1
- package/lib/components/VPagination/VPagination.js.map +1 -1
- package/lib/components/VPicker/VPicker.js +1 -1
- package/lib/components/VPicker/VPicker.js.map +1 -1
- package/lib/components/VRadioGroup/VRadio.js +2 -2
- package/lib/components/VRadioGroup/VRadio.js.map +1 -1
- package/lib/components/VSelect/VSelect.js +2 -2
- package/lib/components/VSelect/VSelect.js.map +1 -1
- package/lib/components/VSelect/VSelectList.js +2 -2
- package/lib/components/VSelect/VSelectList.js.map +1 -1
- package/lib/components/VSlideGroup/VSlideGroup.js +3 -3
- package/lib/components/VSlideGroup/VSlideGroup.js.map +1 -1
- package/lib/components/VSlider/VSlider.js +26 -21
- package/lib/components/VSlider/VSlider.js.map +1 -1
- package/lib/components/VStepper/VStepperContent.js +1 -1
- package/lib/components/VStepper/VStepperContent.js.map +1 -1
- package/lib/components/VSwitch/VSwitch.js +1 -1
- package/lib/components/VSwitch/VSwitch.js.map +1 -1
- package/lib/components/VTabs/VTabs.js +2 -2
- package/lib/components/VTabs/VTabs.js.map +1 -1
- package/lib/components/VTextField/VTextField.js +1 -1
- package/lib/components/VTextField/VTextField.js.map +1 -1
- package/lib/components/VTooltip/VTooltip.js +7 -10
- package/lib/components/VTooltip/VTooltip.js.map +1 -1
- package/lib/components/VTreeview/VTreeviewNode.js +3 -3
- package/lib/components/VTreeview/VTreeviewNode.js.map +1 -1
- package/lib/components/transitions/createTransition.js +2 -2
- package/lib/components/transitions/createTransition.js.map +1 -1
- package/lib/framework.js +1 -1
- package/lib/mixins/picker/index.js +5 -3
- package/lib/mixins/picker/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/VAppBar/VAppBarNavIcon.ts +1 -1
- package/src/components/VBanner/VBanner.ts +3 -3
- package/src/components/VBreadcrumbs/VBreadcrumbs.ts +2 -2
- package/src/components/VBtn/VBtn.ts +24 -16
- package/src/components/VBtn/__tests__/VBtn.spec.ts +257 -242
- package/src/components/VBtn/__tests__/__snapshots__/VBtn.spec.ts.snap +13 -73
- package/src/components/VCarousel/VCarousel.ts +3 -3
- package/src/components/VCarousel/VCarouselItem.ts +1 -1
- package/src/components/VCheckbox/VCheckbox.ts +1 -1
- package/src/components/VColorPicker/VColorPicker.ts +32 -35
- package/src/components/VColorPicker/VColorPickerCanvas.ts +44 -37
- package/src/components/VColorPicker/VColorPickerEdit.ts +37 -35
- package/src/components/VColorPicker/VColorPickerPreview.ts +48 -28
- package/src/components/VColorPicker/VColorPickerSwatches.ts +23 -12
- package/src/components/VColorPicker/__tests__/VColorPicker.spec.ts +47 -47
- package/src/components/VColorPicker/__tests__/VColorPickerCanvas.spec.ts +15 -13
- package/src/components/VColorPicker/__tests__/VColorPickerEdit.spec.ts +52 -50
- package/src/components/VColorPicker/__tests__/VColorPickerPreview.spec.ts +101 -30
- package/src/components/VColorPicker/__tests__/__snapshots__/VColorPicker.spec.ts.snap +200 -157
- package/src/components/VColorPicker/__tests__/__snapshots__/VColorPickerEdit.spec.ts.snap +28 -11
- package/src/components/VDataIterator/VDataFooter.ts +1 -1
- package/src/components/VDataTable/VDataTable.ts +8 -8
- package/src/components/VDataTable/VDataTableHeader.ts +2 -4
- package/src/components/VDataTable/VEditDialog.ts +2 -2
- package/src/components/VDataTable/mixins/header.ts +1 -1
- package/src/components/VDatePicker/VDatePickerHeader.ts +3 -3
- package/src/components/VDatePicker/VDatePickerTitle.ts +2 -2
- package/src/components/VDatePicker/mixins/date-picker-table.ts +1 -1
- package/src/components/VDialog/VDialog.ts +2 -2
- package/src/components/VExpansionPanel/VExpansionPanelContent.ts +1 -1
- package/src/components/VExpansionPanel/VExpansionPanelHeader.ts +2 -2
- package/src/components/VImg/VImg.ts +2 -2
- package/src/components/VInput/VInput.ts +10 -4
- package/src/components/VInput/__tests__/VInput.spec.ts +170 -234
- package/src/components/VInput/__tests__/__snapshots__/VInput.spec.ts.snap +50 -101
- package/src/components/VList/VListGroup.ts +5 -5
- package/src/components/VList/VListItem.ts +7 -4
- package/src/components/VMessages/VMessages.ts +1 -1
- package/src/components/VOverflowBtn/VOverflowBtn.ts +1 -1
- package/src/components/VPagination/VPagination.ts +1 -1
- package/src/components/VPicker/VPicker.ts +1 -1
- package/src/components/VRadioGroup/VRadio.ts +2 -2
- package/src/components/VSelect/VSelect.ts +2 -2
- package/src/components/VSelect/VSelectList.ts +3 -3
- package/src/components/VSkeletonLoader/__tests__/VSkeletonLoader.spec.ts +22 -15
- package/src/components/VSkeletonLoader/__tests__/__snapshots__/VSkeletonLoader.spec.ts.snap +60 -60
- package/src/components/VSlideGroup/VSlideGroup.ts +3 -3
- package/src/components/VSlider/VSlider.ts +44 -28
- package/src/components/VSlider/__tests__/VSlider.spec.ts +188 -286
- package/src/components/VSlider/__tests__/__snapshots__/VSlider.spec.ts.snap +157 -246
- package/src/components/VStepper/VStepperContent.ts +1 -1
- package/src/components/VSwitch/VSwitch.ts +1 -1
- package/src/components/VTabs/VTabs.ts +2 -2
- package/src/components/VTabs/__tests__/VTab.spec.ts +3 -3
- package/src/components/VTabs/__tests__/VTabsBar.spec.ts +2 -2
- package/src/components/VTextField/VTextField.ts +1 -1
- package/src/components/VTooltip/VTooltip.ts +21 -21
- package/src/components/VTooltip/__tests__/VTooltip.spec.ts +60 -75
- package/src/components/VTreeview/VTreeviewNode.ts +3 -3
- package/src/components/transitions/createTransition.ts +2 -2
- package/src/mixins/picker/index.ts +4 -4
|
@@ -4,14 +4,15 @@ import VSlider from '../VSlider'
|
|
|
4
4
|
// Utilities
|
|
5
5
|
import {
|
|
6
6
|
mount,
|
|
7
|
-
|
|
7
|
+
VueWrapper,
|
|
8
|
+
enableAutoUnmount,
|
|
8
9
|
} from '@vue/test-utils'
|
|
9
10
|
|
|
10
11
|
/* eslint-disable max-statements */
|
|
11
12
|
describe('VSlider.ts', () => {
|
|
12
13
|
type Instance = InstanceType<typeof VSlider>
|
|
13
|
-
let mountFunction: (options?: object) =>
|
|
14
|
-
let el
|
|
14
|
+
let mountFunction: (options?: object) => VueWrapper<Instance>
|
|
15
|
+
let el: HTMLElement
|
|
15
16
|
|
|
16
17
|
beforeEach(() => {
|
|
17
18
|
el = document.createElement('div')
|
|
@@ -19,11 +20,11 @@ describe('VSlider.ts', () => {
|
|
|
19
20
|
document.body.appendChild(el)
|
|
20
21
|
mountFunction = (options = {}) => {
|
|
21
22
|
return mount(VSlider, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
global: {
|
|
24
|
+
mocks: {
|
|
25
|
+
$vuetify: {
|
|
26
|
+
rtl: false,
|
|
27
|
+
},
|
|
27
28
|
},
|
|
28
29
|
},
|
|
29
30
|
...options,
|
|
@@ -31,9 +32,8 @@ describe('VSlider.ts', () => {
|
|
|
31
32
|
}
|
|
32
33
|
})
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
})
|
|
35
|
+
// Включаем автоматическое размонтирование компонентов после каждого теста
|
|
36
|
+
enableAutoUnmount(afterEach)
|
|
37
37
|
|
|
38
38
|
it('should match a snapshot', () => {
|
|
39
39
|
const wrapper = mountFunction()
|
|
@@ -43,7 +43,7 @@ describe('VSlider.ts', () => {
|
|
|
43
43
|
|
|
44
44
|
it('should render vertical slider', async () => {
|
|
45
45
|
const wrapper = mountFunction({
|
|
46
|
-
|
|
46
|
+
props: {
|
|
47
47
|
vertical: true,
|
|
48
48
|
},
|
|
49
49
|
})
|
|
@@ -53,48 +53,36 @@ describe('VSlider.ts', () => {
|
|
|
53
53
|
|
|
54
54
|
it('should render component with ticks and match a snapshot', async () => {
|
|
55
55
|
const wrapper = mountFunction({
|
|
56
|
-
|
|
57
|
-
ticks:
|
|
56
|
+
props: {
|
|
57
|
+
ticks: true,
|
|
58
58
|
step: 25,
|
|
59
59
|
},
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
expect('Invalid prop: custom validator check failed for prop "ticks"').toHaveBeenWarned()
|
|
63
|
-
|
|
64
|
-
wrapper.setProps({ ticks: true })
|
|
65
|
-
await wrapper.vm.$nextTick()
|
|
66
|
-
|
|
67
62
|
expect(wrapper.html()).toMatchSnapshot()
|
|
68
63
|
|
|
69
|
-
wrapper.setProps({ ticks: 'always' })
|
|
70
|
-
await wrapper.vm.$nextTick()
|
|
64
|
+
await wrapper.setProps({ ticks: 'always' })
|
|
71
65
|
|
|
72
66
|
expect(wrapper.html()).toMatchSnapshot()
|
|
73
67
|
})
|
|
74
68
|
|
|
75
69
|
it('should render component with thumbLabel and match a snapshot', async () => {
|
|
76
70
|
const wrapper = mountFunction({
|
|
77
|
-
|
|
78
|
-
thumbLabel:
|
|
71
|
+
props: {
|
|
72
|
+
thumbLabel: true,
|
|
79
73
|
},
|
|
80
74
|
})
|
|
81
75
|
|
|
82
|
-
expect('Invalid prop: custom validator check failed for prop "thumbLabel"').toHaveBeenWarned()
|
|
83
|
-
|
|
84
|
-
wrapper.setProps({ thumbLabel: true })
|
|
85
|
-
await wrapper.vm.$nextTick()
|
|
86
|
-
|
|
87
76
|
expect(wrapper.html()).toMatchSnapshot()
|
|
88
77
|
|
|
89
|
-
wrapper.setProps({ thumbLabel: 'always' })
|
|
90
|
-
await wrapper.vm.$nextTick()
|
|
78
|
+
await wrapper.setProps({ thumbLabel: 'always' })
|
|
91
79
|
|
|
92
80
|
expect(wrapper.html()).toMatchSnapshot()
|
|
93
81
|
})
|
|
94
82
|
|
|
95
83
|
it('should set tabindex in disabled component', () => {
|
|
96
84
|
const wrapper = mountFunction({
|
|
97
|
-
|
|
85
|
+
props: {
|
|
98
86
|
disabled: true,
|
|
99
87
|
},
|
|
100
88
|
})
|
|
@@ -106,293 +94,269 @@ describe('VSlider.ts', () => {
|
|
|
106
94
|
|
|
107
95
|
it('should not allow values outside of min/max', async () => {
|
|
108
96
|
const wrapper = mountFunction({
|
|
109
|
-
|
|
97
|
+
props: {
|
|
110
98
|
min: 2,
|
|
111
99
|
max: 4,
|
|
112
100
|
},
|
|
113
101
|
})
|
|
114
102
|
|
|
115
|
-
|
|
116
|
-
wrapper.
|
|
117
|
-
|
|
118
|
-
wrapper.setProps({ value: 0 })
|
|
119
|
-
await wrapper.vm.$nextTick()
|
|
120
|
-
expect(input).toHaveBeenCalledWith(2)
|
|
103
|
+
await wrapper.setProps({ modelValue: 0 })
|
|
104
|
+
const events1 = wrapper.emitted('update:modelValue') as any[][]
|
|
105
|
+
expect(events1[events1.length - 1]).toEqual([2])
|
|
121
106
|
|
|
122
|
-
wrapper.setProps({
|
|
123
|
-
|
|
124
|
-
expect(
|
|
107
|
+
await wrapper.setProps({ modelValue: 5 })
|
|
108
|
+
const events2 = wrapper.emitted('update:modelValue') as any[][]
|
|
109
|
+
expect(events2[events2.length - 1]).toEqual([4])
|
|
125
110
|
})
|
|
126
111
|
|
|
127
112
|
it('should adjust value if min/max props change', async () => {
|
|
128
113
|
const wrapper = mountFunction({
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
props: {
|
|
115
|
+
modelValue: 5,
|
|
131
116
|
min: 0,
|
|
132
117
|
max: 10,
|
|
133
118
|
},
|
|
134
119
|
})
|
|
135
120
|
|
|
136
|
-
|
|
137
|
-
wrapper.
|
|
138
|
-
|
|
139
|
-
wrapper.setProps({ min: 6 })
|
|
140
|
-
await wrapper.vm.$nextTick()
|
|
141
|
-
expect(input).toHaveBeenCalledWith(6)
|
|
121
|
+
await wrapper.setProps({ min: 6 })
|
|
122
|
+
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([6])
|
|
142
123
|
|
|
143
|
-
wrapper.setProps({ max: 4 })
|
|
144
|
-
|
|
145
|
-
expect(input).toHaveBeenCalledWith(4)
|
|
124
|
+
await wrapper.setProps({ max: 4 })
|
|
125
|
+
expect(wrapper.emitted('update:modelValue')?.[1]).toEqual([4])
|
|
146
126
|
})
|
|
147
127
|
|
|
148
128
|
it('should round value with offset correct', async () => {
|
|
149
129
|
const wrapper = mountFunction({
|
|
150
|
-
|
|
130
|
+
props: {
|
|
151
131
|
min: 3,
|
|
152
132
|
max: 15,
|
|
153
133
|
step: 3,
|
|
154
134
|
},
|
|
155
135
|
})
|
|
156
136
|
|
|
157
|
-
|
|
158
|
-
wrapper.
|
|
159
|
-
|
|
160
|
-
wrapper.setProps({ value: 5 })
|
|
161
|
-
await wrapper.vm.$nextTick()
|
|
162
|
-
expect(input).toHaveBeenLastCalledWith(6)
|
|
137
|
+
await wrapper.setProps({ modelValue: 5 })
|
|
138
|
+
const events1 = wrapper.emitted('update:modelValue') as any[][]
|
|
139
|
+
expect(events1[events1.length - 1]).toEqual([6])
|
|
163
140
|
|
|
164
|
-
wrapper.setProps({
|
|
165
|
-
|
|
166
|
-
expect(
|
|
141
|
+
await wrapper.setProps({ modelValue: 7 })
|
|
142
|
+
const events2 = wrapper.emitted('update:modelValue') as any[][]
|
|
143
|
+
expect(events2[events2.length - 1]).toEqual([6])
|
|
167
144
|
})
|
|
168
145
|
|
|
169
146
|
it('should react to keydown event', async () => {
|
|
170
147
|
const wrapper = mountFunction({
|
|
171
|
-
|
|
172
|
-
|
|
148
|
+
props: {
|
|
149
|
+
modelValue: 50,
|
|
173
150
|
},
|
|
174
151
|
})
|
|
175
152
|
|
|
176
|
-
const input = jest.fn()
|
|
177
|
-
wrapper.vm.$on('input', input)
|
|
178
|
-
|
|
179
153
|
const slider = wrapper.find('.v-slider__thumb-container')
|
|
180
154
|
|
|
181
|
-
slider.trigger('keydown.space')
|
|
182
|
-
expect(
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
expect(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
slider.trigger('keydown.
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
wrapper.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
expect(
|
|
203
|
-
|
|
204
|
-
slider.trigger('keydown.pageup')
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
slider.trigger('keydown.
|
|
155
|
+
await slider.trigger('keydown.space')
|
|
156
|
+
expect(wrapper.emitted('update:modelValue')).toBeFalsy()
|
|
157
|
+
|
|
158
|
+
await slider.trigger('keydown.left')
|
|
159
|
+
const events1 = wrapper.emitted('update:modelValue') as any[][]
|
|
160
|
+
expect(events1[events1.length - 1]).toEqual([49])
|
|
161
|
+
|
|
162
|
+
await slider.trigger('keydown.right')
|
|
163
|
+
const events2 = wrapper.emitted('update:modelValue') as any[][]
|
|
164
|
+
expect(events2[events2.length - 1]).toEqual([50])
|
|
165
|
+
|
|
166
|
+
await slider.trigger('keydown.home')
|
|
167
|
+
const events3 = wrapper.emitted('update:modelValue') as any[][]
|
|
168
|
+
expect(events3[events3.length - 1]).toEqual([0])
|
|
169
|
+
|
|
170
|
+
await slider.trigger('keydown.end')
|
|
171
|
+
const events4 = wrapper.emitted('update:modelValue') as any[][]
|
|
172
|
+
expect(events4[events4.length - 1]).toEqual([100])
|
|
173
|
+
|
|
174
|
+
await slider.trigger('keydown.pagedown')
|
|
175
|
+
const events5 = wrapper.emitted('update:modelValue') as any[][]
|
|
176
|
+
expect(events5[events5.length - 1]).toEqual([90])
|
|
177
|
+
|
|
178
|
+
await slider.trigger('keydown.pageup')
|
|
179
|
+
const events6 = wrapper.emitted('update:modelValue') as any[][]
|
|
180
|
+
expect(events6[events6.length - 1]).toEqual([100])
|
|
181
|
+
|
|
182
|
+
await wrapper.setProps({ step: 4 })
|
|
183
|
+
await slider.trigger('keydown.pagedown')
|
|
184
|
+
const events7 = wrapper.emitted('update:modelValue') as any[][]
|
|
185
|
+
expect(events7[events7.length - 1]).toEqual([60])
|
|
186
|
+
|
|
187
|
+
await wrapper.setProps({ step: 2 })
|
|
188
|
+
await slider.trigger('keydown.pageup')
|
|
189
|
+
const events8 = wrapper.emitted('update:modelValue') as any[][]
|
|
190
|
+
expect(events8[events8.length - 1]).toEqual([80])
|
|
191
|
+
|
|
192
|
+
await wrapper.setProps({ max: 1000 })
|
|
193
|
+
await slider.trigger('keydown.pageup')
|
|
194
|
+
const events9 = wrapper.emitted('update:modelValue') as any[][]
|
|
195
|
+
expect(events9[events9.length - 1]).toEqual([180])
|
|
196
|
+
|
|
197
|
+
await wrapper.setProps({ max: 100 })
|
|
198
|
+
|
|
199
|
+
// После изменения max, значение должно быть ограничено до 100
|
|
200
|
+
// Нужно обновить modelValue чтобы симулировать поведение родительского компонента
|
|
201
|
+
const maxChangeEvents = wrapper.emitted('update:modelValue') as any[][]
|
|
202
|
+
const newValue = maxChangeEvents[maxChangeEvents.length - 1][0]
|
|
203
|
+
await wrapper.setProps({ modelValue: newValue })
|
|
204
|
+
|
|
205
|
+
await slider.trigger('keydown.left', {
|
|
210
206
|
shiftKey: true,
|
|
211
207
|
})
|
|
212
|
-
|
|
208
|
+
const events10 = wrapper.emitted('update:modelValue') as any[][]
|
|
209
|
+
expect(events10[events10.length - 1]).toEqual([94])
|
|
213
210
|
|
|
214
|
-
slider.trigger('keydown.right', {
|
|
211
|
+
await slider.trigger('keydown.right', {
|
|
215
212
|
ctrlKey: true,
|
|
216
213
|
})
|
|
217
|
-
|
|
218
|
-
expect(
|
|
214
|
+
const events11 = wrapper.emitted('update:modelValue') as any[][]
|
|
215
|
+
expect(events11[events11.length - 1]).toEqual([98])
|
|
219
216
|
|
|
220
|
-
wrapper.setProps({ disabled: true })
|
|
217
|
+
await wrapper.setProps({ disabled: true })
|
|
218
|
+
const eventsBeforeDisabled = wrapper.emitted('update:modelValue')?.length || 0
|
|
219
|
+
await slider.trigger('keydown.left')
|
|
220
|
+
// Количество событий не должно измениться
|
|
221
|
+
expect(wrapper.emitted('update:modelValue')?.length).toBe(eventsBeforeDisabled)
|
|
221
222
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
expect(input).toHaveBeenCalledTimes(12)
|
|
223
|
+
await wrapper.setProps({ disabled: false })
|
|
225
224
|
|
|
226
|
-
|
|
225
|
+
// Устанавливаем RTL режим
|
|
226
|
+
await wrapper.setProps({})
|
|
227
227
|
wrapper.vm.$vuetify.rtl = true
|
|
228
228
|
|
|
229
|
-
slider.trigger('keydown.right', {
|
|
229
|
+
await slider.trigger('keydown.right', {
|
|
230
230
|
shiftKey: true,
|
|
231
231
|
})
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
const events12 = wrapper.emitted('update:modelValue') as any[][]
|
|
233
|
+
expect(events12[events12.length - 1]).toEqual([92])
|
|
234
234
|
})
|
|
235
235
|
|
|
236
236
|
it('should add for to label', () => {
|
|
237
237
|
const wrapper = mountFunction({
|
|
238
|
-
|
|
239
|
-
attrs: { id: 'foo' },
|
|
240
|
-
propsData: {
|
|
238
|
+
props: {
|
|
241
239
|
label: 'bar',
|
|
242
240
|
},
|
|
241
|
+
attrs: { id: 'foo' },
|
|
243
242
|
})
|
|
244
243
|
|
|
245
244
|
const label = wrapper.find('.v-label')
|
|
246
|
-
|
|
247
245
|
expect(label.element.getAttribute('for')).toBe('foo')
|
|
248
246
|
|
|
249
247
|
const wrapper2 = mountFunction({
|
|
250
|
-
|
|
251
|
-
propsData: {
|
|
248
|
+
props: {
|
|
252
249
|
label: 'bar',
|
|
253
250
|
},
|
|
254
251
|
})
|
|
255
252
|
|
|
256
253
|
const label2 = wrapper2.find('.v-label')
|
|
257
|
-
|
|
258
|
-
expect(label2.element.getAttribute('for')).toBe(`input-${(wrapper2.vm as any)._uid}`)
|
|
254
|
+
expect(label2.element.getAttribute('for')).toBe(`input-${(wrapper2.vm as any).$.uid}`)
|
|
259
255
|
})
|
|
260
256
|
|
|
261
257
|
it('should deactivate', async () => {
|
|
262
|
-
const wrapper = mountFunction(
|
|
263
|
-
attachToDocument: true,
|
|
264
|
-
})
|
|
265
|
-
|
|
258
|
+
const wrapper = mountFunction()
|
|
266
259
|
const container = wrapper.find('.v-slider__thumb-container')
|
|
267
260
|
|
|
268
261
|
expect(wrapper.vm.isActive).toBe(false)
|
|
269
|
-
|
|
270
|
-
container.trigger('mousedown')
|
|
271
|
-
|
|
262
|
+
await container.trigger('mousedown')
|
|
272
263
|
expect(wrapper.vm.isActive).toBe(true)
|
|
273
264
|
})
|
|
274
265
|
|
|
275
266
|
it('should react to touch', async () => {
|
|
276
|
-
const wrapper = mountFunction(
|
|
277
|
-
attachToDocument: true,
|
|
278
|
-
})
|
|
279
|
-
|
|
267
|
+
const wrapper = mountFunction()
|
|
280
268
|
const container = wrapper.find('.v-slider__thumb-container')
|
|
281
269
|
|
|
282
270
|
expect(wrapper.vm.thumbPressed).toBe(false)
|
|
283
271
|
expect(wrapper.vm.isActive).toBe(false)
|
|
284
272
|
|
|
285
|
-
container.trigger('mousedown')
|
|
286
|
-
|
|
287
|
-
await wrapper.vm.$nextTick()
|
|
288
|
-
|
|
273
|
+
await container.trigger('mousedown')
|
|
289
274
|
expect(wrapper.vm.thumbPressed).toBe(true)
|
|
290
275
|
expect(wrapper.vm.isActive).toBe(true)
|
|
291
276
|
|
|
292
|
-
|
|
293
|
-
|
|
277
|
+
wrapper.vm.app.dispatchEvent(new Event('mouseup'))
|
|
278
|
+
await wrapper.vm.$nextTick()
|
|
294
279
|
expect(wrapper.vm.thumbPressed).toBe(false)
|
|
295
280
|
expect(wrapper.vm.isActive).toBe(false)
|
|
296
281
|
|
|
297
|
-
container.trigger('touchstart', {
|
|
282
|
+
await container.trigger('touchstart', {
|
|
298
283
|
touches: [{}],
|
|
299
284
|
})
|
|
300
|
-
|
|
301
|
-
await wrapper.vm.$nextTick()
|
|
302
|
-
|
|
303
285
|
expect(wrapper.vm.thumbPressed).toBe(true)
|
|
304
286
|
expect(wrapper.vm.isActive).toBe(true)
|
|
305
287
|
|
|
306
|
-
|
|
307
|
-
|
|
288
|
+
wrapper.vm.app.dispatchEvent(new Event('touchend'))
|
|
289
|
+
await wrapper.vm.$nextTick()
|
|
308
290
|
expect(wrapper.vm.thumbPressed).toBe(false)
|
|
309
291
|
expect(wrapper.vm.isActive).toBe(false)
|
|
310
292
|
})
|
|
311
293
|
|
|
312
|
-
it('should return a rounded value', () => {
|
|
294
|
+
it('should return a rounded value', async () => {
|
|
313
295
|
const wrapper = mountFunction({
|
|
314
|
-
|
|
296
|
+
props: { step: 0 },
|
|
315
297
|
})
|
|
316
298
|
|
|
317
299
|
expect(wrapper.vm.roundValue(1.234)).toBe(1.234)
|
|
318
300
|
|
|
319
|
-
wrapper.setProps({ step: 1 })
|
|
320
|
-
|
|
301
|
+
await wrapper.setProps({ step: 1 })
|
|
321
302
|
expect(wrapper.vm.roundValue(1.234)).toBe(1)
|
|
322
303
|
|
|
323
|
-
wrapper.setProps({ step: 4 })
|
|
324
|
-
|
|
304
|
+
await wrapper.setProps({ step: 4 })
|
|
325
305
|
expect(wrapper.vm.roundValue(5.667)).toBe(4)
|
|
326
|
-
|
|
327
306
|
expect(wrapper.vm.roundValue(7.667)).toBe(8)
|
|
328
307
|
|
|
329
|
-
wrapper.setProps({ step: 2.5 })
|
|
330
|
-
|
|
308
|
+
await wrapper.setProps({ step: 2.5 })
|
|
331
309
|
expect(wrapper.vm.roundValue(5.667)).toBe(5)
|
|
332
310
|
})
|
|
333
311
|
|
|
334
312
|
it('should return a rounded value with offset', async () => {
|
|
335
313
|
const wrapper = mountFunction({
|
|
336
|
-
|
|
314
|
+
props: { step: 0 },
|
|
337
315
|
})
|
|
338
316
|
|
|
339
317
|
expect(wrapper.vm.roundValue(1.234)).toBe(1.234)
|
|
340
318
|
|
|
341
|
-
wrapper.setProps({ step: 1 })
|
|
342
|
-
await wrapper.vm.$nextTick()
|
|
343
|
-
|
|
319
|
+
await wrapper.setProps({ step: 1 })
|
|
344
320
|
expect(wrapper.vm.roundValue(1.234)).toBe(1)
|
|
345
321
|
|
|
346
|
-
wrapper.setProps({ step: 4, min: 2 })
|
|
347
|
-
await wrapper.vm.$nextTick()
|
|
348
|
-
|
|
322
|
+
await wrapper.setProps({ step: 4, min: 2 })
|
|
349
323
|
expect(wrapper.vm.roundValue(5.667)).toBe(6)
|
|
350
324
|
expect(wrapper.vm.roundValue(7.667)).toBe(6)
|
|
351
325
|
|
|
352
|
-
wrapper.setProps({ step: 2.5, min: 5 })
|
|
353
|
-
await wrapper.vm.$nextTick()
|
|
354
|
-
|
|
326
|
+
await wrapper.setProps({ step: 2.5, min: 5 })
|
|
355
327
|
expect(wrapper.vm.roundValue(5.667)).toBe(5)
|
|
356
328
|
})
|
|
357
329
|
|
|
358
330
|
it('should return a rounded value bounded by min and max', async () => {
|
|
359
331
|
const wrapper = mountFunction({
|
|
360
|
-
|
|
332
|
+
props: {
|
|
361
333
|
min: 5,
|
|
362
334
|
max: 10,
|
|
363
335
|
},
|
|
364
336
|
})
|
|
365
337
|
|
|
366
|
-
wrapper.setProps({
|
|
367
|
-
await wrapper.vm.$nextTick()
|
|
338
|
+
await wrapper.setProps({ modelValue: 1 })
|
|
368
339
|
expect(wrapper.vm.internalValue).toBe(5)
|
|
369
340
|
|
|
370
|
-
wrapper.setProps({
|
|
371
|
-
await wrapper.vm.$nextTick()
|
|
341
|
+
await wrapper.setProps({ modelValue: 15 })
|
|
372
342
|
expect(wrapper.vm.internalValue).toBe(10)
|
|
373
343
|
})
|
|
374
344
|
|
|
375
345
|
it('should not update if value matches lazy value', async () => {
|
|
376
346
|
const wrapper = mountFunction({
|
|
377
|
-
|
|
378
|
-
|
|
347
|
+
props: {
|
|
348
|
+
modelValue: 10,
|
|
379
349
|
},
|
|
380
350
|
})
|
|
381
351
|
|
|
382
|
-
const input = jest.fn()
|
|
383
|
-
wrapper.vm.$on('input', input)
|
|
384
|
-
await wrapper.vm.$nextTick()
|
|
385
|
-
|
|
386
352
|
expect(wrapper.vm.lazyValue).toBe(10)
|
|
387
353
|
|
|
388
354
|
wrapper.vm.internalValue = 15
|
|
389
|
-
|
|
390
|
-
expect(input).toHaveBeenCalledTimes(1)
|
|
355
|
+
expect(wrapper.emitted('update:modelValue')?.length).toBe(1)
|
|
391
356
|
expect(wrapper.vm.lazyValue).toBe(15)
|
|
392
357
|
|
|
393
358
|
wrapper.vm.internalValue = 15
|
|
394
|
-
|
|
395
|
-
expect(input).toHaveBeenCalledTimes(1)
|
|
359
|
+
expect(wrapper.emitted('update:modelValue')?.length).toBe(1)
|
|
396
360
|
})
|
|
397
361
|
|
|
398
362
|
it('should react to input events', async () => {
|
|
@@ -408,33 +372,26 @@ describe('VSlider.ts', () => {
|
|
|
408
372
|
expect(wrapper.vm.isActive).toBe(false)
|
|
409
373
|
expect(wrapper.vm.isFocused).toBe(false)
|
|
410
374
|
|
|
411
|
-
input.trigger('focus')
|
|
412
|
-
|
|
375
|
+
await input.trigger('focus')
|
|
413
376
|
expect(wrapper.vm.isFocused).toBe(true)
|
|
414
|
-
expect(focus).
|
|
415
|
-
|
|
416
|
-
input.trigger('blur')
|
|
377
|
+
expect(wrapper.emitted('focus')?.length).toBe(1)
|
|
417
378
|
|
|
379
|
+
await input.trigger('blur')
|
|
418
380
|
expect(wrapper.vm.isFocused).toBe(false)
|
|
419
|
-
expect(blur).
|
|
381
|
+
expect(wrapper.emitted('blur')?.length).toBe(1)
|
|
420
382
|
})
|
|
421
383
|
|
|
422
384
|
it('should call mousemove and emit change', () => {
|
|
423
385
|
const wrapper = mountFunction()
|
|
424
|
-
|
|
425
|
-
const change = jest.fn()
|
|
426
|
-
wrapper.vm.$on('change', change)
|
|
427
386
|
const input = wrapper.find('.v-slider')
|
|
428
387
|
|
|
429
388
|
input.trigger('click')
|
|
430
|
-
|
|
431
|
-
expect(change).toHaveBeenCalledTimes(1)
|
|
389
|
+
expect(wrapper.emitted('change')?.length).toBe(1)
|
|
432
390
|
})
|
|
433
391
|
|
|
434
392
|
it('should keep thumb-label when focused and clicked', async () => {
|
|
435
|
-
const onBlur = jest.fn()
|
|
436
393
|
const wrapper = mountFunction({
|
|
437
|
-
|
|
394
|
+
props: {
|
|
438
395
|
thumbLabel: true,
|
|
439
396
|
},
|
|
440
397
|
})
|
|
@@ -442,15 +399,15 @@ describe('VSlider.ts', () => {
|
|
|
442
399
|
const input = wrapper.find('.v-slider__thumb-container')
|
|
443
400
|
const thumb = wrapper.find('.v-slider__thumb-container')
|
|
444
401
|
|
|
445
|
-
input.trigger('focus')
|
|
402
|
+
await input.trigger('focus')
|
|
446
403
|
|
|
447
404
|
expect(wrapper.vm.showThumbLabel).toBe(true)
|
|
448
405
|
expect(wrapper.vm.isActive).toBe(false)
|
|
449
406
|
expect(wrapper.vm.isFocused).toBe(true)
|
|
450
407
|
|
|
451
408
|
// Clicking thumb label triggers blur
|
|
452
|
-
thumb.trigger('mousedown')
|
|
453
|
-
input.trigger('blur')
|
|
409
|
+
await thumb.trigger('mousedown')
|
|
410
|
+
await input.trigger('blur')
|
|
454
411
|
|
|
455
412
|
expect(wrapper.vm.isActive).toBe(true)
|
|
456
413
|
expect(wrapper.vm.isFocused).toBe(false)
|
|
@@ -458,14 +415,12 @@ describe('VSlider.ts', () => {
|
|
|
458
415
|
|
|
459
416
|
it('should reverse label location when inverse', async () => {
|
|
460
417
|
const wrapper = mountFunction({
|
|
461
|
-
|
|
418
|
+
props: { label: 'foo' },
|
|
462
419
|
})
|
|
463
420
|
|
|
464
421
|
expect(wrapper.html()).toMatchSnapshot()
|
|
465
422
|
|
|
466
|
-
wrapper.setProps({ inverseLabel: true })
|
|
467
|
-
await wrapper.vm.$nextTick()
|
|
468
|
-
|
|
423
|
+
await wrapper.setProps({ inverseLabel: true })
|
|
469
424
|
expect(wrapper.html()).toMatchSnapshot()
|
|
470
425
|
})
|
|
471
426
|
|
|
@@ -474,36 +429,26 @@ describe('VSlider.ts', () => {
|
|
|
474
429
|
|
|
475
430
|
expect(wrapper.html()).toMatchSnapshot()
|
|
476
431
|
|
|
477
|
-
wrapper.setProps({
|
|
478
|
-
await wrapper.vm.$nextTick()
|
|
479
|
-
|
|
432
|
+
await wrapper.setProps({ modelValue: 50 })
|
|
480
433
|
expect(wrapper.html()).toMatchSnapshot()
|
|
481
434
|
|
|
482
|
-
wrapper.setProps({ disabled: true })
|
|
483
|
-
await wrapper.vm.$nextTick()
|
|
484
|
-
|
|
435
|
+
await wrapper.setProps({ disabled: true })
|
|
485
436
|
expect(wrapper.html()).toMatchSnapshot()
|
|
486
437
|
|
|
487
438
|
wrapper.vm.$vuetify.rtl = true
|
|
488
|
-
wrapper.setProps({
|
|
489
|
-
await wrapper.vm.$nextTick()
|
|
490
|
-
|
|
439
|
+
await wrapper.setProps({ modelValue: 0, disabled: false })
|
|
491
440
|
expect(wrapper.html()).toMatchSnapshot()
|
|
492
441
|
|
|
493
|
-
wrapper.setProps({
|
|
494
|
-
await wrapper.vm.$nextTick()
|
|
495
|
-
|
|
442
|
+
await wrapper.setProps({ modelValue: 50 })
|
|
496
443
|
expect(wrapper.html()).toMatchSnapshot()
|
|
497
444
|
|
|
498
|
-
wrapper.setProps({ disabled: true })
|
|
499
|
-
await wrapper.vm.$nextTick()
|
|
500
|
-
|
|
445
|
+
await wrapper.setProps({ disabled: true })
|
|
501
446
|
expect(wrapper.html()).toMatchSnapshot()
|
|
502
447
|
})
|
|
503
448
|
|
|
504
449
|
it('should display label and have different aria-label', () => {
|
|
505
450
|
const wrapper = mountFunction({
|
|
506
|
-
|
|
451
|
+
props: { label: 'foo' },
|
|
507
452
|
attrs: { 'aria-label': 'bar' },
|
|
508
453
|
})
|
|
509
454
|
|
|
@@ -512,7 +457,7 @@ describe('VSlider.ts', () => {
|
|
|
512
457
|
|
|
513
458
|
it('should display tick labels', () => {
|
|
514
459
|
const wrapper = mountFunction({
|
|
515
|
-
|
|
460
|
+
props: {
|
|
516
461
|
max: 1,
|
|
517
462
|
tickLabels: ['foo', 'bar'],
|
|
518
463
|
},
|
|
@@ -521,131 +466,88 @@ describe('VSlider.ts', () => {
|
|
|
521
466
|
const ticks = wrapper.findAll('.v-slider__tick')
|
|
522
467
|
|
|
523
468
|
expect(ticks).toHaveLength(2)
|
|
524
|
-
expect((ticks
|
|
525
|
-
expect((ticks
|
|
469
|
+
expect((ticks[0].element.firstChild as HTMLElement).innerHTML).toBe('foo')
|
|
470
|
+
expect((ticks[1].element.firstChild as HTMLElement).innerHTML).toBe('bar')
|
|
526
471
|
})
|
|
527
472
|
|
|
528
|
-
it('should not react to keydown if disabled', () => {
|
|
529
|
-
const parseKeyDown = jest.fn()
|
|
473
|
+
it('should not react to keydown if disabled', async () => {
|
|
530
474
|
const wrapper = mountFunction({
|
|
531
|
-
|
|
532
|
-
methods: { parseKeyDown },
|
|
475
|
+
props: { disabled: true, modelValue: 50 },
|
|
533
476
|
})
|
|
534
477
|
|
|
535
478
|
const input = wrapper.find('.v-slider__thumb-container')
|
|
536
479
|
|
|
537
|
-
|
|
480
|
+
// Тестируем disabled состояние
|
|
481
|
+
await input.trigger('keydown.right')
|
|
482
|
+
expect(wrapper.emitted('update:modelValue')).toBeFalsy()
|
|
538
483
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
wrapper.setProps({
|
|
484
|
+
// Тестируем readonly состояние
|
|
485
|
+
await wrapper.setProps({
|
|
542
486
|
disabled: false,
|
|
543
487
|
readonly: true,
|
|
544
488
|
})
|
|
489
|
+
await input.trigger('keydown.right')
|
|
490
|
+
expect(wrapper.emitted('update:modelValue')).toBeFalsy()
|
|
545
491
|
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
expect(parseKeyDown).not.toHaveBeenCalled()
|
|
549
|
-
|
|
550
|
-
wrapper.setProps({
|
|
492
|
+
// Тестируем нормальное состояние
|
|
493
|
+
await wrapper.setProps({
|
|
551
494
|
disabled: false,
|
|
552
495
|
readonly: false,
|
|
553
496
|
})
|
|
554
|
-
|
|
555
|
-
input.trigger('keydown.right')
|
|
556
|
-
|
|
557
|
-
expect(
|
|
497
|
+
const eventsBefore = wrapper.emitted('update:modelValue')?.length || 0
|
|
498
|
+
await input.trigger('keydown.right')
|
|
499
|
+
const eventsAfter = wrapper.emitted('update:modelValue')?.length || 0
|
|
500
|
+
expect(wrapper.emitted('update:modelValue')).toBeTruthy()
|
|
501
|
+
expect(eventsAfter).toBeGreaterThan(eventsBefore)
|
|
558
502
|
})
|
|
559
503
|
|
|
560
504
|
it('should set value to min value if given a NaN value', () => {
|
|
561
|
-
const input = jest.fn()
|
|
562
|
-
mountFunction({
|
|
563
|
-
propsData: {
|
|
564
|
-
min: -20,
|
|
565
|
-
max: 20,
|
|
566
|
-
value: NaN,
|
|
567
|
-
},
|
|
568
|
-
listeners: {
|
|
569
|
-
input,
|
|
570
|
-
},
|
|
571
|
-
})
|
|
572
|
-
|
|
573
|
-
expect(input).toHaveBeenCalledTimes(1)
|
|
574
|
-
expect(input).toHaveBeenCalledWith(-20)
|
|
575
|
-
})
|
|
576
|
-
|
|
577
|
-
it('should correctly handle initial value of zero (#7320)', () => {
|
|
578
|
-
const input = jest.fn()
|
|
579
505
|
const wrapper = mountFunction({
|
|
580
|
-
|
|
506
|
+
props: {
|
|
581
507
|
min: -20,
|
|
582
508
|
max: 20,
|
|
583
|
-
|
|
584
|
-
},
|
|
585
|
-
listeners: {
|
|
586
|
-
input,
|
|
509
|
+
modelValue: NaN,
|
|
587
510
|
},
|
|
588
511
|
})
|
|
589
512
|
|
|
590
|
-
expect(
|
|
591
|
-
expect(wrapper.html()).toMatchSnapshot()
|
|
513
|
+
expect(wrapper.emitted('update:modelValue')?.[0]).toEqual([-20])
|
|
592
514
|
})
|
|
593
515
|
|
|
594
|
-
|
|
595
|
-
// https://github.com/vuejs/vue-test-utils/issues/1130
|
|
596
|
-
it.skip('should correctly handle setting value to zero (#7320)', async () => {
|
|
597
|
-
const input = jest.fn()
|
|
516
|
+
it('should correctly handle initial value of zero (#7320)', () => {
|
|
598
517
|
const wrapper = mountFunction({
|
|
599
|
-
|
|
518
|
+
props: {
|
|
600
519
|
min: -20,
|
|
601
520
|
max: 20,
|
|
602
|
-
|
|
603
|
-
},
|
|
604
|
-
listeners: {
|
|
605
|
-
input,
|
|
521
|
+
modelValue: 0,
|
|
606
522
|
},
|
|
607
523
|
})
|
|
608
524
|
|
|
609
|
-
wrapper.
|
|
610
|
-
value: 0,
|
|
611
|
-
})
|
|
612
|
-
await wrapper.vm.$nextTick()
|
|
613
|
-
|
|
614
|
-
expect(input).not.toHaveBeenCalledWith(-20)
|
|
525
|
+
expect(wrapper.emitted('update:modelValue')).toBeFalsy()
|
|
615
526
|
expect(wrapper.html()).toMatchSnapshot()
|
|
616
527
|
})
|
|
617
528
|
|
|
618
|
-
// https://github.com/vuetifyjs/vuetify/issues/10018
|
|
619
529
|
it('should not fire event if value is provided and valid', async () => {
|
|
620
|
-
const
|
|
621
|
-
|
|
622
|
-
propsData: { value: 10, min: -20 },
|
|
623
|
-
listeners: { input },
|
|
530
|
+
const wrapper = mountFunction({
|
|
531
|
+
props: { modelValue: 10, min: -20 },
|
|
624
532
|
})
|
|
625
533
|
|
|
626
|
-
expect(
|
|
534
|
+
expect(wrapper.emitted('update:modelValue')).toBeFalsy()
|
|
627
535
|
|
|
628
536
|
// Should set to min value if invalid
|
|
629
|
-
mountFunction({
|
|
630
|
-
|
|
631
|
-
listeners: { input },
|
|
537
|
+
const wrapper2 = mountFunction({
|
|
538
|
+
props: { modelValue: NaN, min: -20 },
|
|
632
539
|
})
|
|
633
540
|
|
|
634
|
-
expect(
|
|
541
|
+
expect(wrapper2.emitted('update:modelValue')?.[0]).toEqual([-20])
|
|
635
542
|
})
|
|
636
543
|
|
|
637
|
-
// https://github.com/vuetifyjs/vuetify/issues/11569
|
|
638
544
|
it('should not fire change event onKeyDown if value is invalid', () => {
|
|
639
|
-
const change = jest.fn()
|
|
640
545
|
const wrapper = mountFunction({
|
|
641
|
-
|
|
642
|
-
listeners: { change },
|
|
546
|
+
props: { min: 1 },
|
|
643
547
|
})
|
|
644
548
|
|
|
645
549
|
const slider = wrapper.find('.v-slider__thumb-container')
|
|
646
|
-
|
|
647
550
|
slider.trigger('keydown.left')
|
|
648
|
-
|
|
649
|
-
expect(change).not.toHaveBeenCalled()
|
|
551
|
+
expect(wrapper.emitted('change')).toBeFalsy()
|
|
650
552
|
})
|
|
651
553
|
})
|