From 3d2e654b1f51737dbe10317322c9ce64d97066fc Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Tue, 21 Nov 2023 20:04:04 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A1=A5=E5=85=85=20globalData=20?= =?UTF-8?q?=E7=A4=BA=E4=BE=8B=E5=8F=8A=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/API/get-app/get-app.test.js | 8 +++++++- pages/API/get-app/get-app.uvue | 25 +++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/pages/API/get-app/get-app.test.js b/pages/API/get-app/get-app.test.js index 10343798..4d229d7e 100644 --- a/pages/API/get-app/get-app.test.js +++ b/pages/API/get-app/get-app.test.js @@ -8,10 +8,16 @@ describe('getApp', () => { }) it('globalData', async () => { await page.callMethod('getGlobalData') - const data = await page.data() + let data = await page.data() expect(data.globalDataStr).toBe('global data str') expect(data.globalDataNum).toBe(123) expect(data.globalDataBool).toBe(true) + await page.callMethod('setGlobalData') + await page.callMethod('getGlobalData') + data = await page.data() + expect(data.globalDataStr).toBe('new global data str') + expect(data.globalDataNum).toBe(456) + expect(data.globalDataBool).toBe(false) }) it('method', async () => { const oldLifeCycleNum = await page.data('lifeCycleNum') diff --git a/pages/API/get-app/get-app.uvue b/pages/API/get-app/get-app.uvue index 737d0975..3b8365db 100644 --- a/pages/API/get-app/get-app.uvue +++ b/pages/API/get-app/get-app.uvue @@ -2,15 +2,14 @@ - -