From 4dd22a56074cb5ce032d5abbb7c0683d70c0bb62 Mon Sep 17 00:00:00 2001 From: anne-xml Date: Tue, 26 Nov 2024 16:48:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85wxcomponents=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 7 ++- pages/tabBar/template.uvue | 4 +- .../template/vant-button/vant-button.test.js | 24 ----------- pages/template/vant-button/vant-button.uvue | 37 ---------------- pages/template/vant/vant.test.js | 28 ++++++++++++ pages/template/vant/vant.uvue | 43 +++++++++++++++++++ 6 files changed, 78 insertions(+), 65 deletions(-) delete mode 100644 pages/template/vant-button/vant-button.test.js delete mode 100644 pages/template/vant-button/vant-button.uvue create mode 100644 pages/template/vant/vant.test.js create mode 100644 pages/template/vant/vant.uvue diff --git a/pages.json b/pages.json index bb03a6ee..f3017ae6 100644 --- a/pages.json +++ b/pages.json @@ -2285,12 +2285,15 @@ // #endif // #ifdef MP { - "path" : "pages/template/vant-button/vant-button", + "path" : "pages/template/vant/vant", "style" : { "navigationBarTitleText": "微信自定义组件示例", "usingComponents": { - "van-button": "/wxcomponents/vant/button/index" + "vant-button": "/wxcomponents/vant/button/index", + "vant-icon": "/wxcomponents/vant/icon/index", + "vant-info": "/wxcomponents/vant/info/index", + "vant-loading": "/wxcomponents/vant/loading/index" } } } diff --git a/pages/tabBar/template.uvue b/pages/tabBar/template.uvue index a2feb658..50de9860 100644 --- a/pages/tabBar/template.uvue +++ b/pages/tabBar/template.uvue @@ -216,8 +216,8 @@ // #endif // #ifdef MP { - id: 'vant-button', - url: 'vant-button', + id: 'vant', + url: 'vant', name: '微信自定义组件示例', open: false, pages: [] as Page[], diff --git a/pages/template/vant-button/vant-button.test.js b/pages/template/vant-button/vant-button.test.js deleted file mode 100644 index a7e8092b..00000000 --- a/pages/template/vant-button/vant-button.test.js +++ /dev/null @@ -1,24 +0,0 @@ -jest.setTimeout(30000); -describe('test title', () => { - let page, vant; - if (!process.env.uniTestPlatformInfo.startsWith('mp')) { - it('not support', () => { - expect(1).toBe(1) - }) - return - } - beforeAll(async () => { - page = await program.reLaunch('/pages/template/vant-button/vant-button') - await page.waitFor(3000); - vant = await page.$('van-button'); - expect(await page.data('jest')).toBe(false); - }); - it('check title onClick', async () => { - const titleText = await vant.text(); - expect(titleText).toEqual('vant weapp的van-button按钮组件'); - await vant.tap() - await page.waitFor(1000); - console.log('jest', await page.data('jest')) - // expect(await page.data('jest')).toBe(true); - }); -}); diff --git a/pages/template/vant-button/vant-button.uvue b/pages/template/vant-button/vant-button.uvue deleted file mode 100644 index 1640f318..00000000 --- a/pages/template/vant-button/vant-button.uvue +++ /dev/null @@ -1,37 +0,0 @@ - - - - diff --git a/pages/template/vant/vant.test.js b/pages/template/vant/vant.test.js new file mode 100644 index 00000000..fced84e2 --- /dev/null +++ b/pages/template/vant/vant.test.js @@ -0,0 +1,28 @@ +jest.setTimeout(30000); +describe('test vant', () => { + let page,vantBtnContainer,vantBtn; + if (!process.env.uniTestPlatformInfo.startsWith('mp')) { + it('not support', () => { + expect(1).toBe(1) + }) + return + } + beforeAll(async () => { + page = await program.reLaunch('/pages/template/vant/vant') + await page.waitFor(3000); + vantBtnContainer = await page.$('vant-button'); + expect(await page.data('jest')).toBe(false); + }); + afterAll(async () => { + expect(await program.screenshot()).toSaveImageSnapshot(); + }); + it('check title onClick', async () => { + const titleText = await vantBtnContainer.text(); + expect(titleText).toEqual('vant weapp的vant-button按钮组件'); + vantBtn = await vantBtnContainer.$('button') + await vantBtn.tap() + await page.waitFor(1000); + console.log('jest',await page.data('jest')) + expect(await page.data('jest')).toBe(true); + }); +}); diff --git a/pages/template/vant/vant.uvue b/pages/template/vant/vant.uvue new file mode 100644 index 00000000..915b4a16 --- /dev/null +++ b/pages/template/vant/vant.uvue @@ -0,0 +1,43 @@ + + + -- GitLab