From ee8a872cbecee606ea5d2c83ee8a945b4253963b Mon Sep 17 00:00:00 2001 From: yurj26 <1816387074@qq.com> Date: Fri, 30 Jun 2023 12:00:50 +0800 Subject: [PATCH] feat(button): test --- pages/component/button/button.test.js | 18 +++++++----------- pages/component/button/button.uvue | 10 +++++----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/pages/component/button/button.test.js b/pages/component/button/button.test.js index 3a3c2011..98ccf957 100644 --- a/pages/component/button/button.test.js +++ b/pages/component/button/button.test.js @@ -35,9 +35,8 @@ describe('Button.uvue', () => { expect(await textBtn.text()).toEqual('button') }) it('type', async () => { - // TODO 目前获取组件属性只能通过组件的name,并且拿到的是最后一个 - const btn = await page.$('Button') - expect(await btn.property('type')).toBe('warn') + const btn = await page.$('.test-button') + expect(await btn.property('type')).toBe('primary') await page.setData({ type: 'default' }) @@ -50,19 +49,16 @@ describe('Button.uvue', () => { expect(await btn.property('type')).toBe('warn') }) it('size', async () => { - const btn = await page.$('Button') - expect(await btn.property('size')).toBe('mini') - await page.setData({ - size: 'default' - }) - await page.waitFor(500) + const btn = await page.$('.test-button') expect(await btn.property('size')).toBe('default') await page.setData({ size: 'mini' }) + await page.waitFor(500) + expect(await btn.property('size')).toBe('mini') }) it('plain', async () => { - const btn = await page.$('Button') + const btn = await page.$('.test-button') expect(await btn.property('plain')).toBe(false) await page.setData({ plain: true @@ -71,7 +67,7 @@ describe('Button.uvue', () => { expect(await btn.property('plain')).toBe(true) }) it('disabled', async () => { - const btn = await page.$('Button') + const btn = await page.$('.test-button') expect(await btn.property('disabled')).toBe(false) await page.setData({ disabled: true diff --git a/pages/component/button/button.uvue b/pages/component/button/button.uvue index 31a3c1cd..928ece9d 100644 --- a/pages/component/button/button.uvue +++ b/pages/component/button/button.uvue @@ -2,7 +2,8 @@ - + @@ -24,8 +25,7 @@ - + @@ -39,8 +39,8 @@ loading: false, _timer: 0, text: '按钮', - type: 'warn', - size: 'mini', + type: 'primary', + size: 'default', plain: false, disabled: false, count: 0 -- GitLab