diff --git a/packages/vant/src/slider/Slider.tsx b/packages/vant/src/slider/Slider.tsx index d092c9928..bd9fc7b6b 100644 --- a/packages/vant/src/slider/Slider.tsx +++ b/packages/vant/src/slider/Slider.tsx @@ -294,10 +294,12 @@ export default defineComponent({
{ if (typeof index === 'number') { diff --git a/packages/vant/src/slider/test/__snapshots__/demo.spec.ts.snap b/packages/vant/src/slider/test/__snapshots__/demo.spec.ts.snap index a4863ea2d..13a1911d5 100644 --- a/packages/vant/src/slider/test/__snapshots__/demo.spec.ts.snap +++ b/packages/vant/src/slider/test/__snapshots__/demo.spec.ts.snap @@ -79,6 +79,7 @@ exports[`should render demo and match snapshot 1`] = ` aria-valuemin="0" aria-valuenow="50" aria-valuemax="100" + aria-disabled="true" aria-orientation="horizontal" >
diff --git a/packages/vant/src/slider/test/__snapshots__/index.spec.ts.snap b/packages/vant/src/slider/test/__snapshots__/index.spec.ts.snap index 1e56e0d35..9bcc1a281 100644 --- a/packages/vant/src/slider/test/__snapshots__/index.spec.ts.snap +++ b/packages/vant/src/slider/test/__snapshots__/index.spec.ts.snap @@ -29,6 +29,27 @@ exports[`should render left-button、right-button slot correctly 1`] = `
`; +exports[`should render readonly Slider correctly 1`] = ` +
+
+
+
+
+
+
+
+`; + exports[`should render reversed range slider correctly 1`] = `
{ expect(wrapper.emitted('update:modelValue')).toBeFalsy(); }); +test('should render readonly Slider correctly', async () => { + const wrapper = mount(Slider, { + props: { + modelValue: 50, + readonly: true, + }, + }); + + expect(wrapper.html()).toMatchSnapshot(); +}); + test('should allow to drag vertical slider', () => { const restoreMock = mockRect(true);