From a541f83c09d05b4fee3b1ba5e024891e11f2bfc2 Mon Sep 17 00:00:00 2001 From: XHY Date: Thu, 14 Nov 2024 11:53:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20slider=20=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E5=80=BC=E6=BA=A2=E5=87=BA=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 6 +++ .../component/slider/slider-maxValue.test.js | 44 +++++++++++++++++++ pages/component/slider/slider-maxValue.uvue | 37 ++++++++++++++++ testSequencer.js | 1 + 4 files changed, 88 insertions(+) create mode 100644 pages/component/slider/slider-maxValue.test.js create mode 100644 pages/component/slider/slider-maxValue.uvue diff --git a/pages.json b/pages.json index 1c62396c..9b3e4d16 100644 --- a/pages.json +++ b/pages.json @@ -220,6 +220,12 @@ "navigationBarTitleText": "slider-in-swiper" } }, + { + "path": "pages/component/slider/slider-maxValue", + "style": { + "navigationBarTitleText": "slider-maxValue-test" + } + }, { "path": "pages/component/picker-view/picker-view", "group": "0,3,7", diff --git a/pages/component/slider/slider-maxValue.test.js b/pages/component/slider/slider-maxValue.test.js new file mode 100644 index 00000000..bb03050d --- /dev/null +++ b/pages/component/slider/slider-maxValue.test.js @@ -0,0 +1,44 @@ +const PAGE_PATH = '/pages/component/slider/slider-maxValue' + +describe('touch-events-test', () => { + + // 先屏蔽 android 及 web 平台 + if (process.env.uniTestPlatformInfo.startsWith('android') || process.env.uniTestPlatformInfo.startsWith('web')) { + it('other platform', () => { + expect(1).toBe(1) + }) + return + } + + if (process.env.UNI_TEST_DEVICES_DIRECTION == 'landscape') { + it('跳过横屏模式', () => { + expect(1).toBe(1) + }) + return + } + + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(500); + }) + + + it('test-slider-max-value', async () => { + + let iconRect = await page.data('sliderRect') + let x = iconRect.x + 15 + let y = iconRect.y + 15 + + // 滑动事件 + await program.swipe({ + startPoint: {x: x, y: y}, + endPoint: {x: x+1000,y: y}, + duration: 300 + }) + + await page.waitFor(600); + const ret = await page.data('sliderValue') + expect(ret).toBe(10) + }) +}) diff --git a/pages/component/slider/slider-maxValue.uvue b/pages/component/slider/slider-maxValue.uvue new file mode 100644 index 00000000..61546076 --- /dev/null +++ b/pages/component/slider/slider-maxValue.uvue @@ -0,0 +1,37 @@ + + + + + diff --git a/testSequencer.js b/testSequencer.js index 1c2f719e..b5c8662d 100644 --- a/testSequencer.js +++ b/testSequencer.js @@ -8,6 +8,7 @@ const sortTestFilePaths = [ "pages/component/global-events/touch-events.test.js", "pages/component/global-events/touch-events-bubbles.test.js", "pages/component/swiper/swiper2.test.js", + "pages/component/slider/slider-maxValue.test.js", "pages/CSS/overflow/overflow-visible-event.test.js", "pages/component/rich-text/rich-text-complex.test.js" ] -- GitLab