From 1f19dbcd4500805cf94f8c3155e10153d8c20d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Wed, 17 Jul 2024 17:15:22 +0800 Subject: [PATCH] test: add test case (#1007) --- docs/demo/editable.md | 2 +- docs/examples/editable.tsx | 5 ++++- src/Slider.tsx | 2 +- tests/Range.test.tsx | 2 ++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/demo/editable.md b/docs/demo/editable.md index 3c31ad9b4..af8da863c 100644 --- a/docs/demo/editable.md +++ b/docs/demo/editable.md @@ -1,5 +1,5 @@ --- -title: Multiple +title: Editable nav: title: Demo path: /demo diff --git a/docs/examples/editable.tsx b/docs/examples/editable.tsx index 051ef4e8f..179b2ac89 100644 --- a/docs/examples/editable.tsx +++ b/docs/examples/editable.tsx @@ -19,7 +19,7 @@ export default () => { range={{ editable: true, }} - track={false} + // track={false} min={0} max={100} value={value} @@ -35,6 +35,9 @@ export default () => { rail: { background: `linear-gradient(to right, blue, red)`, }, + track: { + background: 'orange', + }, }} /> diff --git a/src/Slider.tsx b/src/Slider.tsx index 78af41525..26688e910 100644 --- a/src/Slider.tsx +++ b/src/Slider.tsx @@ -561,7 +561,7 @@ const Slider = React.forwardRef>((prop diff --git a/tests/Range.test.tsx b/tests/Range.test.tsx index 63010ee4d..a30c6540e 100644 --- a/tests/Range.test.tsx +++ b/tests/Range.test.tsx @@ -660,6 +660,8 @@ describe('Range', () => { doMouseMove(container, 0, 1000); expect(onChange).toHaveBeenCalledWith([50, 100]); + expect(container.querySelectorAll('.rc-slider-track')).toHaveLength(1); + // Fire mouse up fireEvent.mouseUp(container.querySelector('.rc-slider-handle')); expect(onChangeComplete).toHaveBeenCalledWith([50, 100]);