From 1db31cc743c5bfcccd5565cc1547c9583d09e0f8 Mon Sep 17 00:00:00 2001 From: hdx Date: Fri, 26 Jan 2024 15:04:34 +0800 Subject: [PATCH] =?UTF-8?q?component:=20=E8=B0=83=E6=95=B4=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/checkbox/checkbox.test.js | 8 ++++++-- pages/component/radio/radio.test.js | 7 +++++-- pages/component/slider-100/slider-100.test.js | 4 +++- pages/component/slider/slider.test.js | 4 +++- pages/component/switch/switch.test.js | 8 ++++++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/pages/component/checkbox/checkbox.test.js b/pages/component/checkbox/checkbox.test.js index 66db34d3..dcc31fe2 100644 --- a/pages/component/checkbox/checkbox.test.js +++ b/pages/component/checkbox/checkbox.test.js @@ -42,11 +42,15 @@ describe('Checkbox.uvue', () => { }) it('checked', async () => { const cb = await page.$('.cb') - expect(await cb.property('checked')).toBe(true) + // TODO + const newValue1 = await cb.property('checked') + expect(newValue1.toString()).toBe(true + '') await page.setData({ checked: false, }) - expect(await cb.property('checked')).toBe(false) + // TODO + const newValue2 = await cb.property('checked') + expect(newValue2.toString()).toBe(false + '') }) it('color', async () => { const cb = await page.$('.cb') diff --git a/pages/component/radio/radio.test.js b/pages/component/radio/radio.test.js index aca487c8..f0ab5bd6 100644 --- a/pages/component/radio/radio.test.js +++ b/pages/component/radio/radio.test.js @@ -40,11 +40,14 @@ describe('Radio.uvue', () => { }) it('checked', async () => { const radio = await page.$('.r') - expect(await radio.property('checked')).toBe(true) + // TODO + const newValue1 = await radio.property('checked') + expect(newValue1.toString()).toBe(true + '') await page.setData({ checked: false, }) - expect(await radio.property('checked')).toBe(false) + const newValue2 = await radio.property('checked') + expect(newValue2.toString()).toBe(false + '') }) it('color', async () => { const radio = await page.$('.r') diff --git a/pages/component/slider-100/slider-100.test.js b/pages/component/slider-100/slider-100.test.js index bf942e1c..4f3dad86 100644 --- a/pages/component/slider-100/slider-100.test.js +++ b/pages/component/slider-100/slider-100.test.js @@ -15,7 +15,9 @@ describe('slider', () => { // TODO 暂时仅获取第一个 const slider1 = await page.$('.slider') - expect(await slider1.property('value')).toBe(sliderValue) + // TODO + const newValue = await slider1.property('value') + expect(newValue.toString()).toBe(sliderValue + '') // const slider100 = await page.$$('.slider') // for (let i = 0; i < slider100.length; i++) { diff --git a/pages/component/slider/slider.test.js b/pages/component/slider/slider.test.js index f67f77c8..1538512e 100644 --- a/pages/component/slider/slider.test.js +++ b/pages/component/slider/slider.test.js @@ -15,7 +15,9 @@ describe('slider', () => { sliderValue: sliderValue, }) await page.waitFor(100) - expect(await slider.property('value')).toBe(sliderValue) + // TODO + const newValue = await slider.property('value') + expect(newValue.toString()).toBe(sliderValue + '') }) it('color', async () => { const slider = await page.$('.slider-custom-color-and-size') diff --git a/pages/component/switch/switch.test.js b/pages/component/switch/switch.test.js index 9e1f569f..25943899 100644 --- a/pages/component/switch/switch.test.js +++ b/pages/component/switch/switch.test.js @@ -29,13 +29,17 @@ describe('switch', () => { checked: false, }) await page.waitFor(100) - expect(await switch_element.property('checked')).toBe(false) + // TODO + const newValue1 = await switch_element.property('checked') + expect(newValue1.toString()).toBe(false + '') await page.setData({ checked: true, }) await page.waitFor(100) - expect(await switch_element.property('checked')).toBe(true) + // TODO + const newValue2 = await switch_element.property('checked') + expect(newValue2.toString()).toBe(true + '') }) it('color', async () => { const switch_element = await page.$('.switch-color') -- GitLab