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 0a7c48e24c3df5ee9cec802a9183b6480b63ede4..09b29d14af32478978c905bc9f1212377ab429bf 100644 --- a/pages/API/choose-location/choose-location.uvue +++ b/pages/API/choose-location/choose-location.uvue @@ -35,7 +35,8 @@ latitude: [], longitude: [] } as Location, - locationAddress: '' + locationAddress: '', + dialogPagesNum: -1 } }, methods: { @@ -48,6 +49,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('.')