Skip to content

Commit 4929c2c

Browse files
committed
Merge branch 'master' into dev
2 parents 23f139b + e3bc5b4 commit 4929c2c

4 files changed

Lines changed: 31 additions & 7 deletions

File tree

packages/vuetify/src/components/VNumberInput/VNumberInput.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,13 @@ export const VNumberInput = genericComponent<VNumberInputSlots>()({
187187

188188
const canIncrease = computed(() => {
189189
if (controlsDisabled.value) return false
190-
return (model.value ?? 0) as number + props.step <= props.max
190+
if (model.value == null) return true
191+
return model.value + props.step <= props.max
191192
})
192193
const canDecrease = computed(() => {
193194
if (controlsDisabled.value) return false
194-
return (model.value ?? 0) as number - props.step >= props.min
195+
if (model.value == null) return true
196+
return model.value - props.step >= props.min
195197
})
196198

197199
const controlVariant = computed(() => {

packages/vuetify/src/components/VNumberInput/__tests__/VNumberInput.spec.browser.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,28 @@ describe('VNumberInput', () => {
224224
expect(model.value).toBe(-10)
225225
})
226226

227+
it('should have increment enabled when range is entirely negative', async () => {
228+
const model = ref(null)
229+
render(() =>
230+
<VNumberInput min={ -10 } max={ -2 } v-model={ model.value } />
231+
)
232+
233+
expect(screen.getByTestId('increment')).toBeEnabled()
234+
await userEvent.click(screen.getByTestId('increment'))
235+
expect(model.value).toBe(-2)
236+
})
237+
238+
it('should have decrement enabled when range is entirely positive', async () => {
239+
const model = ref(null)
240+
render(() =>
241+
<VNumberInput min={ 2 } max={ 10 } v-model={ model.value } />
242+
)
243+
244+
expect(screen.getByTestId('decrement')).toBeEnabled()
245+
await userEvent.click(screen.getByTestId('decrement'))
246+
expect(model.value).toBe(2)
247+
})
248+
227249
it('supports decimal step', async () => {
228250
const model = ref(0)
229251
render(() => (

packages/vuetify/src/components/VProgressLinear/VProgressLinear.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
153153
style={[
154154
backgroundColorStyles.value,
155155
{
156-
opacity: parseFloat(props.bgOpacity!),
156+
opacity: props.bgOpacity != null ? parseFloat(props.bgOpacity) : undefined,
157157
width: props.stream ? 0 : undefined,
158158
},
159159
props.indeterminate ? {} : splitStyles.value?.background,
@@ -213,7 +213,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
213213
...textColorStyles.value,
214214
[isReversed.value ? 'left' : 'right']: convertToUnit(-height.value),
215215
borderTop: `${convertToUnit(height.value / 2)} dotted`,
216-
opacity: parseFloat(props.bufferOpacity!),
216+
opacity: props.bufferOpacity != null ? parseFloat(props.bufferOpacity) : undefined,
217217
top: `calc(50% - ${convertToUnit(height.value / 4)})`,
218218
width: convertToUnit(100 - normalizedBuffer.value, '%'),
219219
'--v-progress-linear-stream-to': convertToUnit(height.value * (isReversed.value ? 1 : -1)),
@@ -231,7 +231,7 @@ export const VProgressLinear = genericComponent<VProgressLinearSlots>()({
231231
style={[
232232
bufferColorStyles.value,
233233
{
234-
opacity: parseFloat(props.bufferOpacity!),
234+
opacity: props.bufferOpacity != null ? parseFloat(props.bufferOpacity) : undefined,
235235
width: convertToUnit(bufferWidth.value, '%'),
236236
},
237237
splitStyles.value?.buffer,

packages/vuetify/src/composables/focusTrap.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Utilities
2-
import { nextTick, onScopeDispose, toRef, toValue, watch } from 'vue'
2+
import { onScopeDispose, toRef, toValue, watch } from 'vue'
33
import { focusableChildren, IN_BROWSER, propsFactory } from '@/util'
44

55
// Types
@@ -136,7 +136,7 @@ export function useFocusTrap (
136136
document.removeEventListener('pointerdown', onPointerdown)
137137
document.removeEventListener('keydown', captureOnKeydown)
138138

139-
await nextTick()
139+
await new Promise(resolve => requestAnimationFrame(resolve))
140140

141141
if (
142142
isActive.value &&

0 commit comments

Comments
 (0)