@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
|
@@ -19,6 +19,7 @@ import Resize from '../../directives/resize'
|
|
|
19
19
|
import { convertToUnit, getSlot } from '../../util/helpers'
|
|
20
20
|
import { ExtractVue } from './../../util/mixins'
|
|
21
21
|
import mixins from '../../util/mixins'
|
|
22
|
+
import { breaking } from '../../util/console'
|
|
22
23
|
|
|
23
24
|
// Types
|
|
24
25
|
import { VNode } from 'vue/types'
|
|
@@ -122,6 +123,19 @@ export default baseMixins.extend({
|
|
|
122
123
|
},
|
|
123
124
|
},
|
|
124
125
|
|
|
126
|
+
created () {
|
|
127
|
+
const breakingProps = [
|
|
128
|
+
['value', 'modelValue'],
|
|
129
|
+
['onChange', 'onUpdate:modelValue'],
|
|
130
|
+
['onInput', 'onUpdate:modelValue'],
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
/* istanbul ignore next */
|
|
134
|
+
breakingProps.forEach(([original, replacement]) => {
|
|
135
|
+
if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this)
|
|
136
|
+
})
|
|
137
|
+
},
|
|
138
|
+
|
|
125
139
|
watch: {
|
|
126
140
|
alignWithTitle: 'callSlider',
|
|
127
141
|
centered: 'callSlider',
|
|
@@ -5,7 +5,7 @@ import { inject as RegistrableInject } from '../registrable'
|
|
|
5
5
|
|
|
6
6
|
// Utilities
|
|
7
7
|
import { deepEqual } from '../../util/helpers'
|
|
8
|
-
import { consoleError } from '../../util/console'
|
|
8
|
+
import { consoleError, breaking } from '../../util/console'
|
|
9
9
|
import { defineComponent, PropType } from 'vue'
|
|
10
10
|
|
|
11
11
|
// Types
|
|
@@ -222,6 +222,16 @@ export default defineComponent({
|
|
|
222
222
|
},
|
|
223
223
|
|
|
224
224
|
created () {
|
|
225
|
+
const breakingProps = [
|
|
226
|
+
['value', 'modelValue'],
|
|
227
|
+
['onInput', 'onUpdate:modelValue'],
|
|
228
|
+
]
|
|
229
|
+
|
|
230
|
+
/* istanbul ignore next */
|
|
231
|
+
breakingProps.forEach(([original, replacement]) => {
|
|
232
|
+
if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this)
|
|
233
|
+
})
|
|
234
|
+
|
|
225
235
|
this.form && this.form.register(this)
|
|
226
236
|
},
|
|
227
237
|
|
|
@@ -1,19 +1,132 @@
|
|
|
1
|
-
import { consoleWarn, consoleError } from '../console'
|
|
1
|
+
import { consoleWarn, consoleError, consoleInfo, deprecate, breaking, removed } from '../console'
|
|
2
2
|
|
|
3
3
|
describe('console', () => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
// Clear console mocks before each test
|
|
6
|
+
jest.clearAllMocks()
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
describe('consoleWarn', () => {
|
|
10
|
+
it('should generate a warning', () => {
|
|
11
|
+
consoleWarn('foo')
|
|
12
|
+
expect('[Vuetify] foo').toHaveBeenTipped()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('should generate a warning with Vue 3 component', () => {
|
|
16
|
+
const vm = {
|
|
17
|
+
type: { name: 'Vue3Component' },
|
|
18
|
+
props: { color: 'primary', size: 'large' },
|
|
19
|
+
setupState: { isActive: true, count: 0 }
|
|
20
|
+
}
|
|
21
|
+
consoleWarn('Vue 3 warning', vm)
|
|
22
|
+
expect('[Vuetify] Vue 3 warning\n\n(found in <Vue3Component> (props: color, size, setup: isActive, count))').toHaveBeenTipped()
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('should not show duplicate warnings for same component instance', () => {
|
|
26
|
+
const vm = {
|
|
27
|
+
type: { name: 'TestComponent' },
|
|
28
|
+
props: {},
|
|
29
|
+
setupState: {}
|
|
30
|
+
}
|
|
31
|
+
consoleWarn('duplicate warning', vm)
|
|
32
|
+
consoleWarn('duplicate warning', vm) // Should not show again
|
|
33
|
+
expect('[Vuetify] duplicate warning\n\n(found in <TestComponent>)').toHaveBeenTipped()
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
describe('consoleError', () => {
|
|
38
|
+
it('should generate an error', () => {
|
|
39
|
+
consoleError('foo')
|
|
40
|
+
expect('[Vuetify] foo').toHaveBeenWarned()
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('should generate an error with Vue 3 component', () => {
|
|
44
|
+
const vm = {
|
|
45
|
+
type: { name: 'Vue3ErrorComponent' },
|
|
46
|
+
props: { error: true },
|
|
47
|
+
setupState: { hasError: true }
|
|
48
|
+
}
|
|
49
|
+
consoleError('Vue 3 error', vm)
|
|
50
|
+
expect('[Vuetify] Vue 3 error\n\n(found in <Vue3ErrorComponent> (props: error, setup: hasError))').toHaveBeenWarned()
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
describe('deprecate', () => {
|
|
55
|
+
it('should generate deprecation warning', () => {
|
|
56
|
+
deprecate('oldProp', 'newProp')
|
|
57
|
+
expect('[Vuetify] [UPGRADE] \'oldProp\' is deprecated, use \'newProp\' instead.').toHaveBeenTipped()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('should generate deprecation warning with Vue 3 component', () => {
|
|
61
|
+
const vm = {
|
|
62
|
+
type: { name: 'DeprecatedComponent' },
|
|
63
|
+
props: {},
|
|
64
|
+
setupState: {}
|
|
65
|
+
}
|
|
66
|
+
deprecate('oldMethod', 'newMethod', vm)
|
|
67
|
+
expect('[Vuetify] [UPGRADE] \'oldMethod\' is deprecated, use \'newMethod\' instead.\n\n(found in <DeprecatedComponent>)').toHaveBeenTipped()
|
|
68
|
+
})
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
describe('breaking', () => {
|
|
72
|
+
it('should generate breaking change error', () => {
|
|
73
|
+
breaking('removedProp', 'replacementProp')
|
|
74
|
+
expect('[Vuetify] [BREAKING] \'removedProp\' has been removed, use \'replacementProp\' instead.').toHaveBeenWarned()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('should generate breaking change error with Vue 3 component', () => {
|
|
78
|
+
const vm = {
|
|
79
|
+
type: { name: 'BreakingComponent' },
|
|
80
|
+
props: {},
|
|
81
|
+
setupState: {}
|
|
82
|
+
}
|
|
83
|
+
breaking('oldAPI', 'newAPI', vm)
|
|
84
|
+
expect('[Vuetify] [BREAKING] \'oldAPI\' has been removed, use \'newAPI\' instead.\n\n(found in <BreakingComponent>)').toHaveBeenWarned()
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
describe('removed', () => {
|
|
89
|
+
it('should generate removal warning', () => {
|
|
90
|
+
removed('unusedProp')
|
|
91
|
+
expect('[Vuetify] [REMOVED] \'unusedProp\' has been removed. You can safely omit it.').toHaveBeenTipped()
|
|
92
|
+
})
|
|
7
93
|
|
|
8
|
-
|
|
9
|
-
|
|
94
|
+
it('should generate removal warning with Vue 3 component', () => {
|
|
95
|
+
const vm = {
|
|
96
|
+
type: { name: 'RemovedComponent' },
|
|
97
|
+
props: {},
|
|
98
|
+
setupState: {}
|
|
99
|
+
}
|
|
100
|
+
removed('unusedMethod', vm)
|
|
101
|
+
expect('[Vuetify] [REMOVED] \'unusedMethod\' has been removed. You can safely omit it.\n\n(found in <RemovedComponent>)').toHaveBeenTipped()
|
|
102
|
+
})
|
|
10
103
|
})
|
|
11
104
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
105
|
+
describe('component name formatting', () => {
|
|
106
|
+
it('should handle anonymous Vue 3 components', () => {
|
|
107
|
+
const vm = {
|
|
108
|
+
type: {},
|
|
109
|
+
props: {},
|
|
110
|
+
setupState: {}
|
|
111
|
+
}
|
|
112
|
+
consoleWarn('anonymous test', vm)
|
|
113
|
+
expect('[Vuetify] anonymous test\n\n(found in <Anonymous>)').toHaveBeenTipped()
|
|
114
|
+
})
|
|
15
115
|
|
|
16
|
-
|
|
17
|
-
|
|
116
|
+
it('should handle Vue 3 root component', () => {
|
|
117
|
+
const vm = {
|
|
118
|
+
appContext: {
|
|
119
|
+
app: {
|
|
120
|
+
_instance: {
|
|
121
|
+
proxy: {}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Mock the root check
|
|
127
|
+
vm.appContext.app._instance.proxy = vm
|
|
128
|
+
consoleWarn('root test', vm)
|
|
129
|
+
expect('[Vuetify] root test\n\n(found in <Root>)').toHaveBeenTipped()
|
|
130
|
+
})
|
|
18
131
|
})
|
|
19
132
|
})
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
normalizeClasses,
|
|
13
13
|
} from '../helpers'
|
|
14
14
|
import { mount } from '@vue/test-utils'
|
|
15
|
+
import { defineComponent, createApp, h } from 'vue'
|
|
15
16
|
|
|
16
17
|
describe('createSimpleFunctional', () => {
|
|
17
18
|
it('should render with a custom tag', () => {
|
|
@@ -22,7 +23,7 @@ describe('createSimpleFunctional', () => {
|
|
|
22
23
|
it('should render with a user-defined tag', () => {
|
|
23
24
|
const component = createSimpleFunctional('v-test', 'pre')
|
|
24
25
|
const wrapper = mount(component, {
|
|
25
|
-
|
|
26
|
+
props: { tag: 'h1' },
|
|
26
27
|
})
|
|
27
28
|
expect(wrapper.html()).toMatchSnapshot()
|
|
28
29
|
})
|
|
@@ -231,58 +232,85 @@ describe('helpers', () => {
|
|
|
231
232
|
|
|
232
233
|
describe('getSlotType', () => {
|
|
233
234
|
it('should detect old slots', () => {
|
|
234
|
-
const
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
const FooComponent = defineComponent({
|
|
236
|
+
render: () => h('div')
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
const TestComponent = defineComponent({
|
|
240
|
+
components: { foo: FooComponent },
|
|
238
241
|
template: `<foo ref="foo"><template slot="bar">hello</template></foo>`,
|
|
239
|
-
})
|
|
242
|
+
})
|
|
240
243
|
|
|
241
|
-
|
|
244
|
+
const wrapper = mount(TestComponent)
|
|
245
|
+
const fooRef = wrapper.findComponent({ ref: 'foo' })
|
|
246
|
+
|
|
247
|
+
// В Vue 3 все слоты считаются scoped, даже старые
|
|
248
|
+
expect(getSlotType(fooRef.vm, 'bar')).toBe('scoped')
|
|
242
249
|
})
|
|
243
250
|
|
|
244
251
|
it('should detect old scoped slots', () => {
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
252
|
+
const FooComponent = defineComponent({
|
|
253
|
+
render: () => h('div')
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
const TestComponent = defineComponent({
|
|
257
|
+
components: { foo: FooComponent },
|
|
249
258
|
template: `<foo ref="foo"><template slot="bar" slot-scope="data">hello</template></foo>`,
|
|
250
|
-
})
|
|
259
|
+
})
|
|
260
|
+
|
|
261
|
+
const wrapper = mount(TestComponent)
|
|
262
|
+
const fooRef = wrapper.findComponent({ ref: 'foo' })
|
|
251
263
|
|
|
252
|
-
expect(getSlotType(vm
|
|
264
|
+
expect(getSlotType(fooRef.vm, 'bar')).toBe('scoped')
|
|
253
265
|
})
|
|
254
266
|
|
|
255
267
|
it('should detect bare v-slot', () => {
|
|
256
|
-
const
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
268
|
+
const FooComponent = defineComponent({
|
|
269
|
+
render: () => h('div')
|
|
270
|
+
})
|
|
271
|
+
|
|
272
|
+
const TestComponent = defineComponent({
|
|
273
|
+
components: { foo: FooComponent },
|
|
260
274
|
template: `<foo ref="foo"><template #bar>hello</template></foo>`,
|
|
261
|
-
})
|
|
275
|
+
})
|
|
262
276
|
|
|
263
|
-
|
|
277
|
+
const wrapper = mount(TestComponent)
|
|
278
|
+
const fooRef = wrapper.findComponent({ ref: 'foo' })
|
|
279
|
+
|
|
280
|
+
expect(getSlotType(fooRef.vm, 'bar', true)).toBe('v-slot')
|
|
264
281
|
})
|
|
265
282
|
|
|
266
283
|
it('should detect bound v-slot', () => {
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
284
|
+
const FooComponent = defineComponent({
|
|
285
|
+
render: () => h('div')
|
|
286
|
+
})
|
|
287
|
+
|
|
288
|
+
const TestComponent = defineComponent({
|
|
289
|
+
components: { foo: FooComponent },
|
|
271
290
|
template: `<foo ref="foo"><template #bar="data">hello</template></foo>`,
|
|
272
|
-
})
|
|
291
|
+
})
|
|
292
|
+
|
|
293
|
+
const wrapper = mount(TestComponent)
|
|
294
|
+
const fooRef = wrapper.findComponent({ ref: 'foo' })
|
|
273
295
|
|
|
274
|
-
|
|
296
|
+
// В Vue 3 #bar="data" считается v-slot, а не scoped
|
|
297
|
+
expect(getSlotType(fooRef.vm, 'bar', true)).toBe('v-slot')
|
|
275
298
|
})
|
|
276
299
|
|
|
277
300
|
it('should count bare v-slot as scoped', () => {
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
301
|
+
const FooComponent = defineComponent({
|
|
302
|
+
render: () => h('div')
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
const TestComponent = defineComponent({
|
|
306
|
+
components: { foo: FooComponent },
|
|
282
307
|
template: `<foo ref="foo"><template #bar>hello</template></foo>`,
|
|
283
|
-
})
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
const wrapper = mount(TestComponent)
|
|
311
|
+
const fooRef = wrapper.findComponent({ ref: 'foo' })
|
|
284
312
|
|
|
285
|
-
expect(getSlotType(vm
|
|
313
|
+
expect(getSlotType(fooRef.vm, 'bar')).toBe('scoped')
|
|
286
314
|
})
|
|
287
315
|
})
|
|
288
316
|
|
package/src/util/console.ts
CHANGED
|
@@ -13,7 +13,6 @@ function createMessage (message: string, vm?: any, parent?: any): string | void
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
if (vm) {
|
|
16
|
-
// Only show each message once per instance
|
|
17
16
|
vm.$_alreadyWarned = vm.$_alreadyWarned || []
|
|
18
17
|
if (vm.$_alreadyWarned.includes(message)) return
|
|
19
18
|
vm.$_alreadyWarned.push(message)
|
|
@@ -43,7 +42,7 @@ export function deprecate (original: string, replacement: string, vm?: any, pare
|
|
|
43
42
|
consoleWarn(`[UPGRADE] '${original}' is deprecated, use '${replacement}' instead.`, vm, parent)
|
|
44
43
|
}
|
|
45
44
|
export function breaking (original: string, replacement: string, vm?: any, parent?: any) {
|
|
46
|
-
consoleError(`[BREAKING] '${original}' has been removed, use '${replacement}' instead
|
|
45
|
+
consoleError(`[BREAKING] '${original}' has been removed, use '${replacement}' instead.`, vm, parent)
|
|
47
46
|
}
|
|
48
47
|
export function removed (original: string, vm?: any, parent?: any) {
|
|
49
48
|
consoleWarn(`[REMOVED] '${original}' has been removed. You can safely omit it.`, vm, parent)
|
|
@@ -58,47 +57,67 @@ const classify = (str: string) => str
|
|
|
58
57
|
.replace(classifyRE, c => c.toUpperCase())
|
|
59
58
|
.replace(/[-_]/g, '')
|
|
60
59
|
|
|
61
|
-
function formatComponentName (vm: any
|
|
62
|
-
if (vm
|
|
60
|
+
function formatComponentName (vm: any): string {
|
|
61
|
+
if (vm === vm?.appContext?.app?._instance?.proxy) {
|
|
63
62
|
return '<Root>'
|
|
64
63
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
|
|
65
|
+
const { name } = extractComponentInfo(vm)
|
|
66
|
+
const additionalInfo = getAdditionalVue3Info(vm)
|
|
67
|
+
|
|
68
|
+
const componentName = name ? `<${classify(name)}>` : '<Anonymous>'
|
|
69
|
+
const additionalInfoStr = additionalInfo.length > 0 ? ` (${additionalInfo.join(', ')})` : ''
|
|
70
|
+
|
|
71
|
+
return componentName + additionalInfoStr
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function extractComponentInfo (vm: any): { name?: string } {
|
|
75
|
+
const options = vm?.$options || vm?.vnode?.type || vm?.type || vm || {}
|
|
76
|
+
return { name: options.name }
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function getAdditionalVue3Info (vm: any): string[] {
|
|
80
|
+
const additionalInfo: string[] = []
|
|
81
|
+
|
|
82
|
+
if (vm?.props && typeof vm.props === 'object') {
|
|
83
|
+
const propKeys = Object.keys(vm.props).slice(0, 3)
|
|
84
|
+
if (propKeys.length > 0) {
|
|
85
|
+
additionalInfo.push(`props: ${propKeys.join(', ')}${Object.keys(vm.props).length > 3 ? '...' : ''}`)
|
|
86
|
+
}
|
|
75
87
|
}
|
|
76
88
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(
|
|
80
|
-
|
|
89
|
+
if (vm?.setupState && typeof vm.setupState === 'object') {
|
|
90
|
+
const setupKeys = Object.keys(vm.setupState).slice(0, 2)
|
|
91
|
+
if (setupKeys.length > 0) {
|
|
92
|
+
additionalInfo.push(`setup: ${setupKeys.join(', ')}${Object.keys(vm.setupState).length > 2 ? '...' : ''}`)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return additionalInfo
|
|
81
97
|
}
|
|
82
98
|
|
|
83
99
|
function generateComponentTrace (vm: any): string {
|
|
84
|
-
if (vm
|
|
100
|
+
if (vm?.parent || vm?.$parent) {
|
|
85
101
|
const tree: any[] = []
|
|
86
102
|
let currentRecursiveSequence = 0
|
|
87
|
-
|
|
103
|
+
let currentVm = vm
|
|
104
|
+
|
|
105
|
+
while (currentVm) {
|
|
88
106
|
if (tree.length > 0) {
|
|
89
107
|
const last: any = tree[tree.length - 1]
|
|
90
|
-
if (last.constructor ===
|
|
108
|
+
if (last.constructor === currentVm.constructor) {
|
|
91
109
|
currentRecursiveSequence++
|
|
92
|
-
|
|
110
|
+
currentVm = currentVm.parent || currentVm.$parent
|
|
93
111
|
continue
|
|
94
112
|
} else if (currentRecursiveSequence > 0) {
|
|
95
113
|
tree[tree.length - 1] = [last, currentRecursiveSequence]
|
|
96
114
|
currentRecursiveSequence = 0
|
|
97
115
|
}
|
|
98
116
|
}
|
|
99
|
-
tree.push(
|
|
100
|
-
|
|
117
|
+
tree.push(currentVm)
|
|
118
|
+
currentVm = currentVm.parent || currentVm.$parent
|
|
101
119
|
}
|
|
120
|
+
|
|
102
121
|
return '\n\nfound in\n\n' + tree
|
|
103
122
|
.map((vm, i) => `${
|
|
104
123
|
i === 0 ? '---> ' : ' '.repeat(5 + i * 2)
|
package/src/util/helpers.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {defineComponent, h} from 'vue'
|
|
1
|
+
import { defineComponent, h } from 'vue'
|
|
2
2
|
import { VNode, VNodeDirective } from 'vue/types'
|
|
3
3
|
import { VuetifyIcon } from 'vuetify/types/services/icons'
|
|
4
4
|
import { DataTableCompareFunction, SelectItemKey, ItemGroup } from 'vuetify/types'
|
|
@@ -125,7 +125,9 @@ export function deepEqual (a: any, b: any): boolean {
|
|
|
125
125
|
export function getObjectValueByPath (obj: any, path: string, fallback?: any): any {
|
|
126
126
|
// credit: http://stackoverflow.com/questions/6491463/accessing-nested-javascript-objects-with-string-key#comment55278413_6491621
|
|
127
127
|
if (obj == null || !path || typeof path !== 'string') return fallback
|
|
128
|
-
if (path in obj && obj[path] !== undefined)
|
|
128
|
+
if (obj !== null && typeof obj === 'object' && !Array.isArray(obj) && path in obj && obj[path] !== undefined) {
|
|
129
|
+
return obj[path]
|
|
130
|
+
}
|
|
129
131
|
path = path.replace(/\[(\w+)\]/g, '.$1') // convert indexes to properties
|
|
130
132
|
path = path.replace(/^\./, '') // strip a leading dot
|
|
131
133
|
return getNestedValue(obj, path.split('.'), fallback)
|
|
@@ -526,7 +528,7 @@ export function normalizeAttrs (attrs) {
|
|
|
526
528
|
|
|
527
529
|
const obj = {}
|
|
528
530
|
|
|
529
|
-
for(let i = 0; i < keys.length; i++) {
|
|
531
|
+
for (let i = 0; i < keys.length; i++) {
|
|
530
532
|
obj[keys[i]] = attrs[keys[i]]
|
|
531
533
|
}
|
|
532
534
|
|
|
@@ -538,7 +540,9 @@ export function normalizeAttrs (attrs) {
|
|
|
538
540
|
* @param classes - классы в виде строки, объекта или массива
|
|
539
541
|
* @returns объект с нормализованными классами
|
|
540
542
|
*/
|
|
541
|
-
export function normalizeClasses (
|
|
543
|
+
export function normalizeClasses (
|
|
544
|
+
classes: string | Record<string, any> | Array<string | Record<string, any>> | undefined
|
|
545
|
+
): Record<string, any> {
|
|
542
546
|
if (!classes) return {}
|
|
543
547
|
|
|
544
548
|
if (typeof classes === 'object' && !Array.isArray(classes)) {
|