From 1a8ee3b2bea755532e8af187699aef9f7aceaafe Mon Sep 17 00:00:00 2001 From: shutao Date: Fri, 1 Dec 2023 15:52:19 +0800 Subject: [PATCH] =?UTF-8?q?update=20sticky-section.test.js=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9waitFor=E6=9D=A1=E4=BB=B6=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E5=87=86=E7=A1=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/sticky-section/sticky-section.test.js | 6 ++++++ pages/component/sticky-section/sticky-section.uvue | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pages/component/sticky-section/sticky-section.test.js b/pages/component/sticky-section/sticky-section.test.js index bf8d7b32..6487cb14 100644 --- a/pages/component/sticky-section/sticky-section.test.js +++ b/pages/component/sticky-section/sticky-section.test.js @@ -17,8 +17,14 @@ describe('component-native-sticky-section', () => { //滚动回顶部 await page.callMethod('toTop') page.waitFor(100) + await page.setData({ + scrolling: 'true' + }) //跳转到id为C的StickyHeader位置 await page.callMethod('gotoStickyHeader', 'C') + await page.waitFor(async () => { + return await page.data('scrolling') === false; + }); const image = await program.screenshot(); expect(image).toMatchImageSnapshot(); }) diff --git a/pages/component/sticky-section/sticky-section.uvue b/pages/component/sticky-section/sticky-section.uvue index 5cd10d01..dbc81c00 100644 --- a/pages/component/sticky-section/sticky-section.uvue +++ b/pages/component/sticky-section/sticky-section.uvue @@ -1,6 +1,6 @@