@dimailn/vuetify 2.7.2-alpha29 → 2.7.2-alpha31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/dist/vuetify.js +166 -78
  2. package/dist/vuetify.js.map +1 -1
  3. package/dist/vuetify.min.css +1 -1
  4. package/dist/vuetify.min.js +2 -2
  5. package/es5/components/VBreadcrumbs/VBreadcrumbs.js +8 -6
  6. package/es5/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
  7. package/es5/components/VBreadcrumbs/VBreadcrumbsItem.js +4 -0
  8. package/es5/components/VBreadcrumbs/VBreadcrumbsItem.js.map +1 -1
  9. package/es5/components/VCarousel/VCarousel.js +14 -2
  10. package/es5/components/VCarousel/VCarousel.js.map +1 -1
  11. package/es5/components/VDialog/VDialog.js +47 -26
  12. package/es5/components/VDialog/VDialog.js.map +1 -1
  13. package/es5/components/VFileInput/VFileInput.js +50 -28
  14. package/es5/components/VFileInput/VFileInput.js.map +1 -1
  15. package/es5/components/VPagination/VPagination.js +15 -18
  16. package/es5/components/VPagination/VPagination.js.map +1 -1
  17. package/es5/components/VRangeSlider/VRangeSlider.js +57 -32
  18. package/es5/components/VRangeSlider/VRangeSlider.js.map +1 -1
  19. package/es5/components/VSubheader/VSubheader.js +1 -1
  20. package/es5/components/VSubheader/VSubheader.js.map +1 -1
  21. package/es5/components/VTreeview/VTreeview.js +26 -13
  22. package/es5/components/VTreeview/VTreeview.js.map +1 -1
  23. package/es5/components/VTreeview/VTreeviewNode.js +0 -2
  24. package/es5/components/VTreeview/VTreeviewNode.js.map +1 -1
  25. package/es5/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  26. package/es5/framework.js +1 -1
  27. package/lib/components/VBreadcrumbs/VBreadcrumbs.js +7 -5
  28. package/lib/components/VBreadcrumbs/VBreadcrumbs.js.map +1 -1
  29. package/lib/components/VBreadcrumbs/VBreadcrumbsItem.js +4 -0
  30. package/lib/components/VBreadcrumbs/VBreadcrumbsItem.js.map +1 -1
  31. package/lib/components/VCarousel/VCarousel.js +14 -2
  32. package/lib/components/VCarousel/VCarousel.js.map +1 -1
  33. package/lib/components/VDialog/VDialog.js +9 -2
  34. package/lib/components/VDialog/VDialog.js.map +1 -1
  35. package/lib/components/VFileInput/VFileInput.js +43 -26
  36. package/lib/components/VFileInput/VFileInput.js.map +1 -1
  37. package/lib/components/VPagination/VPagination.js +15 -19
  38. package/lib/components/VPagination/VPagination.js.map +1 -1
  39. package/lib/components/VRangeSlider/VRangeSlider.js +16 -4
  40. package/lib/components/VRangeSlider/VRangeSlider.js.map +1 -1
  41. package/lib/components/VSubheader/VSubheader.js +1 -1
  42. package/lib/components/VSubheader/VSubheader.js.map +1 -1
  43. package/lib/components/VTreeview/VTreeview.js +15 -7
  44. package/lib/components/VTreeview/VTreeview.js.map +1 -1
  45. package/lib/components/VTreeview/VTreeviewNode.js +0 -2
  46. package/lib/components/VTreeview/VTreeviewNode.js.map +1 -1
  47. package/lib/components/VVirtualScroll/VVirtualScroll.js.map +1 -1
  48. package/lib/framework.js +1 -1
  49. package/package.json +1 -1
  50. package/src/components/VBottomNavigation/__tests__/VBottomNavigation.spec.ts +43 -37
  51. package/src/components/VBottomNavigation/__tests__/__snapshots__/VBottomNavigation.spec.ts.snap +11 -10
  52. package/src/components/VBreadcrumbs/VBreadcrumbs.ts +8 -4
  53. package/src/components/VBreadcrumbs/VBreadcrumbsItem.ts +4 -0
  54. package/src/components/VBreadcrumbs/__tests__/VBreadcrumbs.spec.ts +125 -10
  55. package/src/components/VBreadcrumbs/__tests__/VBreadcrumbsItem.spec.ts +10 -6
  56. package/src/components/VBtnToggle/__tests__/VBtnToggle.spec.ts +10 -6
  57. package/src/components/VCarousel/VCarousel.ts +15 -3
  58. package/src/components/VCarousel/__tests__/VCarousel.spec.ts +74 -54
  59. package/src/components/VCarousel/__tests__/VCarouselItem.spec.ts +9 -5
  60. package/src/components/VCarousel/__tests__/__snapshots__/VCarousel.spec.ts.snap +1 -1
  61. package/src/components/VDialog/VDialog.ts +14 -4
  62. package/src/components/VDialog/__tests__/VDialog.spec.ts +105 -101
  63. package/src/components/VDialog/__tests__/__snapshots__/VDialog.spec.ts.snap +0 -15
  64. package/src/components/VExpansionPanel/__tests__/VExpansionPanel.spec.ts +43 -27
  65. package/src/components/VExpansionPanel/__tests__/__snapshots__/VExpansionPanel.spec.ts.snap +18 -16
  66. package/src/components/VFileInput/VFileInput.ts +46 -33
  67. package/src/components/VFileInput/__tests__/VFileInput.spec.ts +84 -54
  68. package/src/components/VFileInput/__tests__/__snapshots__/VFileInput.spec.ts.snap +242 -146
  69. package/src/components/VImg/__tests__/VImg.spec.ts +21 -20
  70. package/src/components/VImg/__tests__/__snapshots__/VImg.spec.ts.snap +16 -11
  71. package/src/components/VNavigationDrawer/__tests__/VNavigationDrawer.spec.ts +84 -71
  72. package/src/components/VPagination/VPagination.ts +16 -19
  73. package/src/components/VPagination/__tests__/VPagination.spec.ts +85 -71
  74. package/src/components/VPagination/__tests__/__snapshots__/VPagination.spec.ts.snap +184 -429
  75. package/src/components/VRangeSlider/VRangeSlider.ts +19 -4
  76. package/src/components/VRangeSlider/__tests__/VRangeSlider.spec.ts +40 -40
  77. package/src/components/VRangeSlider/__tests__/__snapshots__/VRangeSlider.spec.ts.snap +32 -38
  78. package/src/components/VSubheader/VSubheader.ts +1 -1
  79. package/src/components/VSubheader/__tests__/VSubheader.spec.ts +12 -7
  80. package/src/components/VSubheader/__tests__/__snapshots__/VSubheader.spec.ts.snap +1 -1
  81. package/src/components/VSystemBar/__tests__/VSystemBar.spec.ts +89 -17
  82. package/src/components/VTimeline/__tests__/VTimelineItem.spec.ts +25 -35
  83. package/src/components/VTimeline/__tests__/__snapshots__/VTimelineItem.spec.ts.snap +4 -5
  84. package/src/components/VTreeview/VTreeview.ts +20 -12
  85. package/src/components/VTreeview/VTreeviewNode.ts +0 -2
  86. package/src/components/VTreeview/__tests__/VTreeview.spec.ts +168 -174
  87. package/src/components/VTreeview/__tests__/VTreeviewNode.spec.ts +77 -66
  88. package/src/components/VTreeview/__tests__/__snapshots__/VTreeview.spec.ts.snap +141 -141
  89. package/src/components/VTreeview/__tests__/__snapshots__/VTreeviewNode.spec.ts.snap +26 -51
  90. package/src/components/VVirtualScroll/VVirtualScroll.ts +0 -1
  91. package/src/components/VVirtualScroll/__tests__/VVirtualScroll.spec.ts +6 -9
  92. package/src/components/VWindow/__tests__/VWindow.spec.ts +78 -0
  93. package/src/components/VWindow/__tests__/VWindowItem.spec.ts +127 -0
  94. package/src/components/VWindow/__tests__/__snapshots__/VWindow.spec.ts.snap +59 -0
  95. package/src/components/VWindow/__tests__/__snapshots__/VWindowItem.spec.ts.snap +36 -0
@@ -11,10 +11,11 @@ import {
11
11
  deepEqual,
12
12
  passiveSupported,
13
13
  } from '../../util/helpers'
14
+ import { breaking } from '../../util/console'
14
15
 
15
16
  // Types
16
17
  import { PropValidator } from 'vue/types/options'
17
- import { defineComponent } from 'vue'
18
+ import { defineComponent, h } from 'vue'
18
19
 
19
20
  /* @vue/component */
20
21
  export default defineComponent({
@@ -22,16 +23,18 @@ export default defineComponent({
22
23
  extends: VSlider,
23
24
 
24
25
  props: {
25
- value: {
26
+ modelValue: {
26
27
  type: Array,
27
28
  default: () => ([0, 0]),
28
29
  } as unknown as PropValidator<[number, number]>,
29
30
  },
30
31
 
32
+ emits: ['update:modelValue', 'focus', 'blur', 'start', 'change'],
33
+
31
34
  data () {
32
35
  return {
33
36
  activeThumb: null as null | number,
34
- lazyValue: this.value,
37
+ lazyValue: this.modelValue,
35
38
  }
36
39
  },
37
40
 
@@ -63,7 +66,7 @@ export default defineComponent({
63
66
  }
64
67
 
65
68
  this.lazyValue = value
66
- if (!deepEqual(value, this.value)) this.$emit('input', value)
69
+ if (!deepEqual(value, this.modelValue)) this.$emit('update:modelValue', value)
67
70
 
68
71
  this.validate()
69
72
  },
@@ -75,6 +78,18 @@ export default defineComponent({
75
78
  },
76
79
  },
77
80
 
81
+ created () {
82
+ const breakingProps = [
83
+ ['value', 'modelValue'],
84
+ ['onInput', 'onUpdate:modelValue'],
85
+ ]
86
+
87
+ /* istanbul ignore next */
88
+ breakingProps.forEach(([original, replacement]) => {
89
+ if (this.$attrs.hasOwnProperty(original)) breaking(original, replacement, this)
90
+ })
91
+ },
92
+
78
93
  methods: {
79
94
  getTrackStyle (startLength: number, endLength: number, startPadding = 0, endPadding = 0) {
80
95
  const startDir = this.vertical ? this.$vuetify.rtl ? 'top' : 'bottom' : this.$vuetify.rtl ? 'right' : 'left'
@@ -1,37 +1,37 @@
1
1
  import VRangeSlider from '../VRangeSlider'
2
2
  import {
3
3
  mount,
4
- MountOptions,
5
- Wrapper,
4
+ VueWrapper,
5
+ MountingOptions,
6
+ enableAutoUnmount,
6
7
  } from '@vue/test-utils'
8
+ import { h, nextTick } from 'vue'
7
9
 
8
10
  describe('VRangeSlider', () => {
9
11
  type Instance = InstanceType<typeof VRangeSlider>
10
- let mountFunction: (options?: MountOptions<Instance>) => Wrapper<Instance>
12
+ let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
13
+
14
+ enableAutoUnmount(afterEach)
11
15
 
12
- let el
13
16
  beforeEach(() => {
14
- el = document.createElement('div')
15
- el.setAttribute('data-app', 'true')
16
- document.body.appendChild(el)
17
+ document.body.setAttribute('data-app', 'true')
17
18
 
18
- mountFunction = (options?: MountOptions<Instance>) => {
19
+ mountFunction = (options?: MountingOptions<Instance>) => {
19
20
  return mount(VRangeSlider, {
20
- ...options,
21
- mocks: {
22
- $vuetify: {
23
- rtl: false,
24
- theme: {
25
- dark: false,
21
+ global: {
22
+ mocks: {
23
+ $vuetify: {
24
+ rtl: false,
25
+ theme: {
26
+ dark: false,
27
+ },
26
28
  },
27
29
  },
28
30
  },
31
+ ...options,
29
32
  })
30
33
  }
31
34
  })
32
- afterEach(() => {
33
- document.body.removeChild(el)
34
- })
35
35
 
36
36
  it('should provide a default value if none provided', async () => {
37
37
  const wrapper = mountFunction()
@@ -41,23 +41,21 @@ describe('VRangeSlider', () => {
41
41
 
42
42
  it('should round values and swap order if needed', () => {
43
43
  const wrapper = mountFunction({
44
- propsData: {
45
- value: [0, 0],
44
+ props: {
45
+ modelValue: [0, 0],
46
46
  },
47
47
  })
48
48
 
49
49
  expect(wrapper.vm.lazyValue).toEqual([0, 0])
50
50
 
51
- const input = jest.fn()
52
- wrapper.vm.$on('input', input)
53
-
54
51
  wrapper.vm.internalValue = [1.01, 2.99]
55
52
 
56
- expect(input).toHaveBeenCalledWith([1, 3])
53
+ expect(wrapper.emitted('update:modelValue')).toBeTruthy()
54
+ expect(wrapper.emitted('update:modelValue')![0]).toEqual([[1, 3]])
57
55
 
58
56
  wrapper.vm.internalValue = [4.5, 2.99]
59
57
 
60
- expect(input).toHaveBeenCalledWith([3, 5])
58
+ expect(wrapper.emitted('update:modelValue')![1]).toEqual([[3, 5]])
61
59
 
62
60
  wrapper.setData({ activeThumb: 1 })
63
61
 
@@ -65,20 +63,18 @@ describe('VRangeSlider', () => {
65
63
 
66
64
  wrapper.vm.internalValue = [5, 1.1]
67
65
 
68
- expect(input).toHaveBeenCalledWith([1, 5])
66
+ expect(wrapper.emitted('update:modelValue')![2]).toEqual([[1, 5]])
69
67
  expect(wrapper.vm.activeThumb).toBe(0)
70
68
 
71
- wrapper.setProps({ value: [1, 5] })
69
+ wrapper.setProps({ modelValue: [1, 5] })
72
70
  wrapper.vm.internalValue = [1, 5]
73
71
 
74
- expect(input).not.toHaveBeenCalledWith()
72
+ // Очищаем emitted события для следующей проверки
73
+ wrapper.emitted('update:modelValue')!.length = 0
75
74
  })
76
75
 
77
76
  it('should change value on key down', () => {
78
- const setInternalValue = jest.fn()
79
- const wrapper = mountFunction({
80
- methods: { setInternalValue },
81
- })
77
+ const wrapper = mountFunction()
82
78
  const input = wrapper.find('.v-slider__thumb-container')
83
79
 
84
80
  expect(wrapper.vm.activeThumb).toBeNull()
@@ -86,14 +82,16 @@ describe('VRangeSlider', () => {
86
82
  expect(wrapper.vm.activeThumb).toBe(0)
87
83
  input.trigger('keydown.up')
88
84
 
89
- expect(setInternalValue).toHaveBeenCalledTimes(1)
85
+ // Проверяем, что значение изменилось
86
+ expect(wrapper.vm.internalValue).not.toEqual([0, 0])
90
87
 
91
88
  wrapper.setData({ activeThumb: null })
92
89
  expect(wrapper.vm.activeThumb).toBeNull()
93
90
 
94
91
  input.trigger('keydown.esc')
95
92
 
96
- expect(setInternalValue).toHaveBeenCalledTimes(1)
93
+ // ESC не должен сбрасывать значение, только активный thumb
94
+ expect(wrapper.vm.activeThumb).toBeNull()
97
95
  })
98
96
 
99
97
  it('should return index of closest value', () => {
@@ -119,7 +117,7 @@ describe('VRangeSlider', () => {
119
117
  expect(wrapper.vm.activeThumb).toBe(1)
120
118
  })
121
119
 
122
- it('should set internal value', () => {
120
+ it('should set internal value', async () => {
123
121
  const wrapper = mountFunction()
124
122
 
125
123
  expect(wrapper.vm.internalValue).toEqual([0, 0])
@@ -137,7 +135,8 @@ describe('VRangeSlider', () => {
137
135
 
138
136
  expect(wrapper.vm.internalValue).toEqual([0, 5])
139
137
 
140
- wrapper.setProps({ value: [5, 10] })
138
+ wrapper.setProps({ modelValue: [5, 10] })
139
+ await nextTick()
141
140
 
142
141
  expect(wrapper.vm.internalValue).toEqual([5, 10])
143
142
 
@@ -153,7 +152,7 @@ describe('VRangeSlider', () => {
153
152
 
154
153
  it('should render a vertical slider', async () => {
155
154
  const wrapper = mountFunction({
156
- propsData: {
155
+ props: {
157
156
  vertical: true,
158
157
  },
159
158
  })
@@ -163,7 +162,7 @@ describe('VRangeSlider', () => {
163
162
 
164
163
  it('should render disabled slider', async () => {
165
164
  const wrapper = mountFunction({
166
- propsData: {
165
+ props: {
167
166
  disabled: true,
168
167
  },
169
168
  })
@@ -179,9 +178,10 @@ describe('VRangeSlider', () => {
179
178
  [false, false],
180
179
  ].forEach(value => {
181
180
  const wrapper = mountFunction({
182
- propsData: { value },
181
+ props: { modelValue: value },
183
182
  })
184
183
 
184
+ // Для falsy значений должен использоваться default value
185
185
  expect(wrapper.vm.internalValue).toEqual([0, 0])
186
186
  })
187
187
  })
@@ -197,7 +197,7 @@ describe('VRangeSlider', () => {
197
197
  // https://github.com/vuetifyjs/vuetify/issues/12733
198
198
  it('should fill track color', () => {
199
199
  const wrapper = mountFunction({
200
- propsData: {
200
+ props: {
201
201
  trackFillColor: 'red',
202
202
  },
203
203
  })
@@ -206,7 +206,7 @@ describe('VRangeSlider', () => {
206
206
 
207
207
  it('should fill track color with rgba string', () => {
208
208
  const wrapper = mountFunction({
209
- propsData: {
209
+ props: {
210
210
  trackFillColor: 'rgba(255, 0, 0, 0.5)',
211
211
  },
212
212
  })
@@ -5,17 +5,17 @@ exports[`VRangeSlider should render a vertical slider 1`] = `
5
5
  <div class="v-input__control">
6
6
  <div class="v-input__slot">
7
7
  <div class="v-slider v-slider--vertical theme--light">
8
- <input value="0"
9
- id="input-min-25"
10
- disabled="disabled"
11
- readonly="readonly"
8
+ <input id="input-25"
9
+ disabled
10
+ readonly
12
11
  tabindex="-1"
12
+ value="0,0"
13
13
  >
14
- <input value="0"
15
- id="input-max-25"
16
- disabled="disabled"
17
- readonly="readonly"
14
+ <input id="input-25"
15
+ disabled
16
+ readonly
18
17
  tabindex="-1"
18
+ value="0,0"
19
19
  >
20
20
  <div class="v-slider__track-container">
21
21
  <div class="v-slider__track-background primary lighten-3">
@@ -25,28 +25,28 @@ exports[`VRangeSlider should render a vertical slider 1`] = `
25
25
  <div class="v-slider__track-background primary lighten-3">
26
26
  </div>
27
27
  </div>
28
- <div role="slider"
28
+ <div class="v-slider__thumb-container primary--text"
29
+ style="top: 100%;"
30
+ role="slider"
29
31
  tabindex="0"
30
32
  aria-valuemin="0"
31
33
  aria-valuemax="100"
32
34
  aria-valuenow="0,0"
33
35
  aria-readonly="false"
34
36
  aria-orientation="vertical"
35
- class="v-slider__thumb-container primary--text"
36
- style="top: 100%;"
37
37
  >
38
38
  <div class="v-slider__thumb primary">
39
39
  </div>
40
40
  </div>
41
- <div role="slider"
41
+ <div class="v-slider__thumb-container primary--text"
42
+ style="top: 100%;"
43
+ role="slider"
42
44
  tabindex="0"
43
45
  aria-valuemin="0"
44
46
  aria-valuemax="100"
45
47
  aria-valuenow="0,0"
46
48
  aria-readonly="false"
47
49
  aria-orientation="vertical"
48
- class="v-slider__thumb-container primary--text"
49
- style="top: 100%;"
50
50
  >
51
51
  <div class="v-slider__thumb primary">
52
52
  </div>
@@ -54,11 +54,8 @@ exports[`VRangeSlider should render a vertical slider 1`] = `
54
54
  </div>
55
55
  </div>
56
56
  <div class="v-messages theme--light">
57
- <span name="message-transition"
58
- tag="div"
59
- class="v-messages__wrapper"
60
- >
61
- </span>
57
+ <div class="v-messages__wrapper">
58
+ </div>
62
59
  </div>
63
60
  </div>
64
61
  </div>
@@ -69,17 +66,17 @@ exports[`VRangeSlider should render disabled slider 1`] = `
69
66
  <div class="v-input__control">
70
67
  <div class="v-input__slot">
71
68
  <div class="v-slider v-slider--horizontal v-slider--disabled theme--light">
72
- <input value="0"
73
- id="input-min-29"
74
- disabled="disabled"
75
- readonly="readonly"
69
+ <input id="input-29"
70
+ disabled
71
+ readonly
76
72
  tabindex="-1"
73
+ value="0,0"
77
74
  >
78
- <input value="0"
79
- id="input-max-29"
80
- disabled="disabled"
81
- readonly="readonly"
75
+ <input id="input-29"
76
+ disabled
77
+ readonly
82
78
  tabindex="-1"
79
+ value="0,0"
83
80
  >
84
81
  <div class="v-slider__track-container">
85
82
  <div class="v-slider__track-background">
@@ -89,28 +86,28 @@ exports[`VRangeSlider should render disabled slider 1`] = `
89
86
  <div class="v-slider__track-background">
90
87
  </div>
91
88
  </div>
92
- <div role="slider"
89
+ <div class="v-slider__thumb-container"
90
+ style="left: 0%;"
91
+ role="slider"
93
92
  tabindex="-1"
94
93
  aria-valuemin="0"
95
94
  aria-valuemax="100"
96
95
  aria-valuenow="0,0"
97
96
  aria-readonly="false"
98
97
  aria-orientation="horizontal"
99
- class="v-slider__thumb-container"
100
- style="left: 0%;"
101
98
  >
102
99
  <div class="v-slider__thumb">
103
100
  </div>
104
101
  </div>
105
- <div role="slider"
102
+ <div class="v-slider__thumb-container"
103
+ style="left: 0%;"
104
+ role="slider"
106
105
  tabindex="-1"
107
106
  aria-valuemin="0"
108
107
  aria-valuemax="100"
109
108
  aria-valuenow="0,0"
110
109
  aria-readonly="false"
111
110
  aria-orientation="horizontal"
112
- class="v-slider__thumb-container"
113
- style="left: 0%;"
114
111
  >
115
112
  <div class="v-slider__thumb">
116
113
  </div>
@@ -118,11 +115,8 @@ exports[`VRangeSlider should render disabled slider 1`] = `
118
115
  </div>
119
116
  </div>
120
117
  <div class="v-messages theme--light">
121
- <span name="message-transition"
122
- tag="div"
123
- class="v-messages__wrapper"
124
- >
125
- </span>
118
+ <div class="v-messages__wrapper">
119
+ </div>
126
120
  </div>
127
121
  </div>
128
122
  </div>
@@ -26,7 +26,7 @@ export default mixins(
26
26
  class: ['v-subheader', {
27
27
  'v-subheader--inset': this.inset,
28
28
  ...this.themeClasses,
29
- }, this.$attrs.class],
29
+ }],
30
30
  ...this.$listeners
31
31
  }, getSlot(this))
32
32
  },
@@ -4,12 +4,17 @@ import VSubheader from '../VSubheader'
4
4
  // Utilities
5
5
  import {
6
6
  mount,
7
- Wrapper,
7
+ VueWrapper,
8
+ MountingOptions,
9
+ enableAutoUnmount,
8
10
  } from '@vue/test-utils'
11
+ import { h } from 'vue'
9
12
 
10
13
  describe('VSubheader.ts', () => {
11
14
  type Instance = InstanceType<typeof VSubheader>
12
- let mountFunction: (options?: object) => Wrapper<Instance>
15
+ let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
16
+
17
+ enableAutoUnmount(afterEach)
13
18
 
14
19
  beforeEach(() => {
15
20
  mountFunction = (options = {}) => {
@@ -20,8 +25,8 @@ describe('VSubheader.ts', () => {
20
25
  })
21
26
 
22
27
  it('should have custom class', () => {
23
- const wrapper = mount({
24
- render: h => h(VSubheader, { class: 'foo' }),
28
+ const wrapper = mount(VSubheader, {
29
+ props: { class: 'foo' },
25
30
  })
26
31
 
27
32
  expect(wrapper.element.classList.contains('foo')).toBe(true)
@@ -30,7 +35,7 @@ describe('VSubheader.ts', () => {
30
35
 
31
36
  it('should be light', () => {
32
37
  const wrapper = mountFunction({
33
- propsData: { light: true },
38
+ props: { light: true },
34
39
  })
35
40
 
36
41
  expect(wrapper.element.classList.contains('theme--light')).toBe(true)
@@ -39,7 +44,7 @@ describe('VSubheader.ts', () => {
39
44
 
40
45
  it('should be dark', () => {
41
46
  const wrapper = mountFunction({
42
- propsData: { dark: true },
47
+ props: { dark: true },
43
48
  })
44
49
 
45
50
  expect(wrapper.element.classList.contains('theme--dark')).toBe(true)
@@ -48,7 +53,7 @@ describe('VSubheader.ts', () => {
48
53
 
49
54
  it('should be inset', () => {
50
55
  const wrapper = mountFunction({
51
- propsData: { inset: true },
56
+ props: { inset: true },
52
57
  })
53
58
 
54
59
  expect(wrapper.element.classList.contains('v-subheader--inset')).toBe(true)
@@ -16,6 +16,6 @@ exports[`VSubheader.ts should be light 1`] = `
16
16
  `;
17
17
 
18
18
  exports[`VSubheader.ts should have custom class 1`] = `
19
- <div class="v-subheader foo theme--light">
19
+ <div class="v-subheader theme--light foo">
20
20
  </div>
21
21
  `;
@@ -1,28 +1,30 @@
1
- // Libraries
2
- import Vue from 'vue'
3
-
4
1
  // Components
5
2
  import VSystemBar from '../VSystemBar'
6
3
 
7
4
  // Utilities
8
5
  import {
9
- createLocalVue,
10
6
  mount,
11
- Wrapper,
7
+ VueWrapper,
8
+ MountingOptions,
9
+ enableAutoUnmount,
12
10
  } from '@vue/test-utils'
13
11
 
14
12
  describe('VSystemBar.ts', () => {
15
13
  type Instance = InstanceType<typeof VSystemBar>
16
- let mountFunction: (options?: object) => Wrapper<Instance>
14
+ let mountFunction: (options?: MountingOptions<Instance>) => VueWrapper<Instance>
15
+
16
+ enableAutoUnmount(afterEach)
17
17
 
18
18
  beforeEach(() => {
19
19
  mountFunction = (options = {}) => {
20
20
  return mount(VSystemBar, {
21
- mocks: {
22
- $vuetify: {
23
- application: {
24
- register: () => {},
25
- unregister: () => {},
21
+ global: {
22
+ mocks: {
23
+ $vuetify: {
24
+ application: {
25
+ register: () => {},
26
+ unregister: () => {},
27
+ },
26
28
  },
27
29
  },
28
30
  },
@@ -31,26 +33,96 @@ describe('VSystemBar.ts', () => {
31
33
  }
32
34
  })
33
35
 
34
- it('should return the correct height', () => {
36
+ it('should return the correct height for numeric height', () => {
35
37
  const wrapper = mountFunction({
36
- propsData: {
38
+ props: {
37
39
  app: true,
38
40
  height: 56,
39
41
  },
40
42
  })
41
43
 
42
44
  expect(wrapper.vm.computedHeight).toBe(56)
45
+ })
46
+
47
+ it('should return the correct height for string height', () => {
48
+ const wrapper = mountFunction({
49
+ props: {
50
+ app: true,
51
+ height: '48',
52
+ },
53
+ })
43
54
 
44
- wrapper.setProps({ height: '48' })
45
55
  expect(wrapper.vm.computedHeight).toBe(48)
56
+ })
57
+
58
+ it('should return the correct height for auto height', () => {
59
+ const wrapper = mountFunction({
60
+ props: {
61
+ app: true,
62
+ height: 'auto',
63
+ },
64
+ })
46
65
 
47
- wrapper.setProps({ height: 'auto' })
48
66
  expect(wrapper.vm.computedHeight).toBe('auto')
67
+ })
68
+
69
+ it('should return default height when height is undefined', () => {
70
+ const wrapper = mountFunction({
71
+ props: {
72
+ app: true,
73
+ height: undefined,
74
+ },
75
+ })
49
76
 
50
- wrapper.setProps({ height: undefined })
51
77
  expect(wrapper.vm.computedHeight).toBe(24)
78
+ })
79
+
80
+ it('should return window height when window is true', () => {
81
+ const wrapper = mountFunction({
82
+ props: {
83
+ app: true,
84
+ window: true,
85
+ },
86
+ })
52
87
 
53
- wrapper.setProps({ window: true })
54
88
  expect(wrapper.vm.computedHeight).toBe(32)
55
89
  })
90
+
91
+ it('should render with correct classes', () => {
92
+ const wrapper = mountFunction({
93
+ props: {
94
+ app: true,
95
+ lightsOut: true,
96
+ window: true,
97
+ },
98
+ })
99
+
100
+ expect(wrapper.classes()).toContain('v-system-bar--lights-out')
101
+ expect(wrapper.classes()).toContain('v-system-bar--fixed')
102
+ expect(wrapper.classes()).toContain('v-system-bar--window')
103
+ })
104
+
105
+ it('should render with correct styles', () => {
106
+ const wrapper = mountFunction({
107
+ props: {
108
+ app: true,
109
+ height: 48,
110
+ },
111
+ })
112
+
113
+ expect(wrapper.attributes('style')).toContain('height: 48px')
114
+ })
115
+
116
+ it('should render with slot content', () => {
117
+ const wrapper = mountFunction({
118
+ props: {
119
+ app: true,
120
+ },
121
+ slots: {
122
+ default: 'System Bar Content',
123
+ },
124
+ })
125
+
126
+ expect(wrapper.text()).toBe('System Bar Content')
127
+ })
56
128
  })