From e80ea7b606ed1e447d88ec1f38b0013f1dda35d5 Mon Sep 17 00:00:00 2001 From: anne-xml Date: Thu, 5 Dec 2024 20:50:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Epage-meta=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/page-meta/page-meta.test.js | 33 +++++++++++ pages/component/page-meta/page-meta.uvue | 65 +++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 pages/component/page-meta/page-meta.test.js create mode 100644 pages/component/page-meta/page-meta.uvue diff --git a/pages/component/page-meta/page-meta.test.js b/pages/component/page-meta/page-meta.test.js new file mode 100644 index 00000000..34ad67d4 --- /dev/null +++ b/pages/component/page-meta/page-meta.test.js @@ -0,0 +1,33 @@ +jest.setTimeout(30000); +describe('test page-meta', () => { + let page,titleEl,cellEl; + if (!process.env.uniTestPlatformInfo.startsWith('mp')) { + it('not support', () => { + expect(1).toBe(1) + }) + return + } + beforeAll(async () => { + page = await program.reLaunch('/pages/component/page-meta/page-meta') + await page.waitFor(3000); + titleEl = await page.$(".title") + cellEl = await page.$(".uni-list-cell") + }); + it('check page-style', async () => { + expect(await titleEl.style('color')).toEqual('rgb(0, 128, 0)'); + expect(await cellEl.style('color')).toEqual('rgb(0, 128, 0)'); + }); + it('check root-font-size', async () => { + expect(await titleEl.style('font-size')).toEqual('30px'); + }); + it('check scrollTop', async () => { + expect(await page.data('scrollTop')).toEqual('0px'); + const buttonEl = await page.$("button") + await buttonEl.tap() + await page.waitFor(2100) + console.log('scrollType',await page.data('scrollType')); + expect(await page.data('scrollTop')).toEqual('300px'); + expect(await page.data('scrollType')).toEqual('scroll'); + expect(await page.data('scrolldoneType')).toEqual('scrolldone'); + }); +}); diff --git a/pages/component/page-meta/page-meta.uvue b/pages/component/page-meta/page-meta.uvue new file mode 100644 index 00000000..ca634e45 --- /dev/null +++ b/pages/component/page-meta/page-meta.uvue @@ -0,0 +1,65 @@ + + + -- GitLab