diff --git a/pages/component/swiper/swiper.uvue b/pages/component/swiper/swiper.uvue index 2ff1a5717694f65fcc7356d4306352a18a4c8e99..bbbfd2022afda97d725302ed6cb8fbff498d00a3 100644 --- a/pages/component/swiper/swiper.uvue +++ b/pages/component/swiper/swiper.uvue @@ -9,9 +9,9 @@ :rebound="reboundSelect" :interval="intervalSelect" :circular="circularSelect" :indicator-color="indicatorColor" :indicator-active-color="indicatorColorActive" :disable-touch="disableTouchSelect" :current="currentVal" :current-item-id="currentItemIdVal" - @change="swiperChange" @transition="swiperTransition" @animationfinish="swiperAnimationfinish"> + @change="swiperChange" @transition="swiperTransition" @animationfinish="swiperAnimationfinish" @touchstart="swipertouchStart"> - A + A B @@ -125,7 +125,13 @@ isAnimationfinishTest: '' } }, - methods: { + methods: { + swipertouchStart(e: UniTouchEvent) { + console.log("swiper touchstart") + }, + viewtouchStart(e: UniTouchEvent) { + console.log("view touchstart:") + }, swiperChange: function (e : UniSwiperChangeEvent) { this.changeDetailTest = e.detail this.checkEventTest({ diff --git a/pages/component/swiper/swiper2.test.js b/pages/component/swiper/swiper2.test.js new file mode 100644 index 0000000000000000000000000000000000000000..fdde0429d1c7f7e77514319f65e4ad7bdeff0bca --- /dev/null +++ b/pages/component/swiper/swiper2.test.js @@ -0,0 +1,34 @@ +const PAGE_PATH = '/pages/component/swiper/swiper' + +describe('swiper-touch-test', () => { + + // 屏蔽 web 平台 + if (process.env.uniTestPlatformInfo.startsWith('web')) { + it('other platform', () => { + expect(1).toBe(1) + }) + return + } + + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(1500); + }) + + + it('swiper-touch-test', async () => { + + await program.swipe({ + startPoint: {x: 246,y: 193}, + endPoint: {x: 1,y: 193}, + duration: 200 + }) + + await page.waitFor(1000) + let val = await page.data('currentValChange') + console.log(val) + expect(val).toEqual(1) + }) + +}) diff --git a/testSequencer.js b/testSequencer.js index 8161e29e869689b421c3fce68170550c5a2b07bd..152f7cfe0837cf652b0fa3896623cc9c179d26a5 100644 --- a/testSequencer.js +++ b/testSequencer.js @@ -6,6 +6,7 @@ const sortTestFilePaths = [ "pages/component/list-view/list-view-refresh.test.js", "pages/component/scroll-view/scroll-view-refresher.test.js", "pages/component/global-events/touch-events.test.js", + "pages/component/swiper/swiper2.test.js", "pages/component/rich-text/rich-text-complex.test.js" ] class CustomSequencer extends Sequencer {