diff --git a/pages/component/button/button.test.js b/pages/component/button/button.test.js index ab21e798998f2c4b6cc2cf2fac7c07df0ea96d69..982186fb785d86a1cb0834870774e9b3fa47b5f5 100644 --- a/pages/component/button/button.test.js +++ b/pages/component/button/button.test.js @@ -76,5 +76,10 @@ describe('Button.uvue', () => { }) const newValue2 = await btn.property('disabled') expect(newValue2.toString()).toBe(true + '') + }) + + it(checkUniButtonElement, async () => { + const value = await page.callMethod('checkUniButtonElement') + expect(value).toBe(true) }) }) diff --git a/pages/component/button/button.uvue b/pages/component/button/button.uvue index ec3646c90e1e2d439c7d1a1d69d5ff9e141598c3..7a000f30eab6197672a6c332c6408e3c323c39ac 100644 --- a/pages/component/button/button.uvue +++ b/pages/component/button/button.uvue @@ -35,14 +35,22 @@ uni.navigateTo({ url: 'buttonstatus', }) - }, + }, + //用于自动化测试 + checkUniButtonElement(): boolean { + const button = uni.getElementById("testButton") + if(button != null && button instanceof UniButtonElement) { + return true + } + return false + } } }