From f12b08cd45d3d91af35bf0111bcca1b6975b46ca Mon Sep 17 00:00:00 2001 From: yurj26 <1816387074@qq.com> Date: Tue, 28 Nov 2023 19:54:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B5=8B=E8=AF=95=E4=BE=8B=E5=85=BC?= =?UTF-8?q?=E5=AE=B9web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component/picker-view/picker-view.test.js | 12 +- pages/component/picker-view/picker-view.uvue | 7 +- pages/component/progress/progress.test.js | 136 +++++++++--------- 3 files changed, 80 insertions(+), 75 deletions(-) diff --git a/pages/component/picker-view/picker-view.test.js b/pages/component/picker-view/picker-view.test.js index a4e515bf..430805e3 100644 --- a/pages/component/picker-view/picker-view.test.js +++ b/pages/component/picker-view/picker-view.test.js @@ -14,15 +14,19 @@ beforeAll(async () => { describe('PickerView.uvue', () => { it('value', async () => { const el = await page.$('.picker-view') - await page.callMethod('setValue') + await page.callMethod('setValue') await page.waitFor(1000) expect(await el.property('value')).toEqual([0, 0, 0]) - expect(await getData('result')).toEqual([0, 0, 0]) + if (process.env.UNI_PLATFORM === 'app-android') { + expect(await getData('result')).toEqual([0, 0, 0]) + } - await page.callMethod('setValue1') + await page.callMethod('setValue1') await page.waitFor(1000) expect(await el.property('value')).toEqual([10, 10, 10]) - expect(await getData('result')).toEqual([10, 10, 10]) + if (process.env.UNI_PLATFORM === 'app-android') { + expect(await getData('result')).toEqual([10, 10, 10]) + } }) it('length', async () => { diff --git a/pages/component/picker-view/picker-view.uvue b/pages/component/picker-view/picker-view.uvue index 45df3fa7..bd21750c 100644 --- a/pages/component/picker-view/picker-view.uvue +++ b/pages/component/picker-view/picker-view.uvue @@ -57,10 +57,7 @@ } }, methods: { - clickView() { - - }, - bindChange(e : PickerViewChangeEvent) { + bindChange(e : PickerViewChangeEvent) { const val = e.detail.value this.result = val this.year = this.years[val[0]] @@ -92,4 +89,4 @@ line-height: 50px; text-align: center; } - \ No newline at end of file + diff --git a/pages/component/progress/progress.test.js b/pages/component/progress/progress.test.js index 6bf464c4..a572aeae 100644 --- a/pages/component/progress/progress.test.js +++ b/pages/component/progress/progress.test.js @@ -1,79 +1,83 @@ function getData(key = '') { - return new Promise(async (resolve, reject) => { - const data = await page.data() - resolve(key ? data[key] : data) - }) + return new Promise(async (resolve, reject) => { + const data = await page.data() + resolve(key ? data[key] : data) + }) } let page beforeAll(async () => { - page = await program.reLaunch('/pages/component/progress/progress') - await page.waitFor(2000); + page = await program.reLaunch('/pages/component/progress/progress') + await page.waitFor(2000); }) describe('Progress.uvue', () => { - it('percent', async () => { - await page.callMethod('setProgress') - await page.waitFor(1000); - const p = await page.$('.p') - expect(await p.property('percent')).toEqual(20) - const p1 = await page.$('.p1') - expect(await p1.property('percent')).toEqual(40) - const p2 = await page.$('.p2') - expect(await p2.property('percent')).toEqual(60) - const p3 = await page.$('.p3') - expect(await p3.property('percent')).toEqual(80) - expect(await getData('curPercent')).toEqual(20) - await page.callMethod('clearProgress') - await page.waitFor(1000) - expect(await p.property('percent')).toEqual(0) - expect(await p1.property('percent')).toEqual(0) - expect(await p2.property('percent')).toEqual(0) - expect(await p3.property('percent')).toEqual(0) - expect(await getData('curPercent')).toEqual(0) - }) - it('length', async () => { - const elements = await page.$$('.progress') - expect(elements.length).toBe(4) + it('percent', async () => { + await page.callMethod('setProgress') + await page.waitFor(1000); + const p = await page.$('.p') + expect(await p.property('percent')).toEqual(20) + const p1 = await page.$('.p1') + expect(await p1.property('percent')).toEqual(40) + const p2 = await page.$('.p2') + expect(await p2.property('percent')).toEqual(60) + const p3 = await page.$('.p3') + expect(await p3.property('percent')).toEqual(80) + if (process.env.UNI_PLATFORM === 'app-android') { + expect(await getData('curPercent')).toEqual(20) + } + await page.callMethod('clearProgress') + await page.waitFor(1000) + expect(await p.property('percent')).toEqual(0) + expect(await p1.property('percent')).toEqual(0) + expect(await p2.property('percent')).toEqual(0) + expect(await p3.property('percent')).toEqual(0) + if (process.env.UNI_PLATFORM === 'app-android') { + expect(await getData('curPercent')).toEqual(0) + } + }) + it('length', async () => { + const elements = await page.$$('.progress') + expect(elements.length).toBe(4) + }) + it('show-info', async () => { + const el = await page.$('.p') + expect(await el.property('show-info')).toEqual(true) + await page.setData({ + showInfo: false }) - it('show-info', async () => { - const el = await page.$('.p') - expect(await el.property('show-info')).toEqual(true) - await page.setData({ - showInfo: false - }) - expect(await el.property('show-info')).toEqual(false) + expect(await el.property('show-info')).toEqual(false) + }) + it('border-radius', async () => { + const el = await page.$('.p') + expect(await el.property('border-radius')).toEqual(0) + await page.setData({ + borderRadius: 5 }) - it('border-radius', async () => { - const el = await page.$('.p') - expect(await el.property('border-radius')).toEqual(0) - await page.setData({ - borderRadius: 5 - }) - expect(await el.property('border-radius')).toEqual(5) + expect(await el.property('border-radius')).toEqual(5) + }) + it('font-size', async () => { + const el = await page.$('.p') + expect(await el.property('font-size')).toEqual(16) + await page.setData({ + fontSize: 18 }) - it('font-size', async () => { - const el = await page.$('.p') - expect(await el.property('font-size')).toEqual(16) - await page.setData({ - fontSize: 18 - }) - expect(await el.property('font-size')).toEqual(18) + expect(await el.property('font-size')).toEqual(18) + }) + it('stroke-width', async () => { + const el = await page.$('.p') + expect(await el.property('stroke-width')).toEqual(3) + await page.setData({ + strokeWidth: 6 }) - it('stroke-width', async () => { - const el = await page.$('.p') - expect(await el.property('stroke-width')).toEqual(3) - await page.setData({ - strokeWidth: 6 - }) - expect(await el.property('stroke-width')).toEqual(6) + expect(await el.property('stroke-width')).toEqual(6) + }) + it('backgroundColor', async () => { + const el = await page.$('.p') + expect(await el.property('background-color')).toEqual('#EBEBEB') + await page.setData({ + backgroundColor: "#007aff" }) - it('backgroundColor', async () => { - const el = await page.$('.p') - expect(await el.property('background-color')).toEqual('#EBEBEB') - await page.setData({ - backgroundColor: "#007aff" - }) - expect(await el.property('background-color')).toEqual('#007aff') - }) -}) + expect(await el.property('background-color')).toEqual('#007aff') + }) +}) \ No newline at end of file -- GitLab