diff --git a/pages/API/choose-location/choose-location.test.js b/pages/API/choose-location/choose-location.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7f64fbe86e25be394c7c6c86e522aa7aceea842a --- /dev/null +++ b/pages/API/choose-location/choose-location.test.js @@ -0,0 +1,21 @@ +describe('dialog page', () => { + if (process.env.UNI_AUTOMATOR_APP_WEBVIEW == 'true') { + it('skip app-webview', () => { + expect(1).toBe(1) + }) + return + } + + let page; + beforeAll(async () => { + page = await program.reLaunch('/pages/API/choose-location/choose-location') + await page.waitFor('view'); + }); + + it('dialogPage should empty', async () => { + await page.callMethod('chooseLocation') + await page.waitFor(1000) + const dialogPagesNum = await page.data('dialogPagesNum') + expect(dialogPagesNum).toBe(0) + }) +}) diff --git a/pages/API/choose-location/choose-location.uvue b/pages/API/choose-location/choose-location.uvue index 6d8e30209651ead5f7ce7c88e9235fb11f6f0fd8..2a4e22f5968090800d9cf5a01ff13e5b13b3771f 100644 --- a/pages/API/choose-location/choose-location.uvue +++ b/pages/API/choose-location/choose-location.uvue @@ -39,7 +39,8 @@ latitude: [], longitude: [] } as Location, - locationAddress: '' + locationAddress: '', + dialogPagesNum: -1 } }, methods: { @@ -52,6 +53,12 @@ this.locationAddress = res.address } }) + setTimeout(() => { + const pages = getCurrentPages() + const page = pages[pages.length - 1] + const dialogPages = page.getDialogPages() + this.dialogPagesNum = dialogPages.length + }, 500) }, formatLocation: function(longitude:number, latitude:number):Location { const longitudeArr = longitude.toString().split('.')