From 8156983776d3ba89264e1c1b84f805976dd73929 Mon Sep 17 00:00:00 2001 From: fxy060608 <153647646@qq.com> Date: Wed, 11 Sep 2024 20:59:15 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4KeepAlive=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/basicTest.test.js | 4 +++- pages/index/basicTest.vue | 22 +++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/pages/index/basicTest.test.js b/pages/index/basicTest.test.js index 63a9eb6..e63897d 100644 --- a/pages/index/basicTest.test.js +++ b/pages/index/basicTest.test.js @@ -58,7 +58,9 @@ if (process.env.UNI_PROJECT_TYPE === '1.0' && (process.env.uniTestPlatformInfo.t describe('testCallbackKeepAlive', () => { it("jest_testCallbackKeepAlive", async () => { const res = await page.callMethod('jest_testCallbackKeepAlive') - expect(res).toEqual(true) + page.waitFor(10) + const count = await page.data('count') + expect(count).toEqual(18) }) }) } \ No newline at end of file diff --git a/pages/index/basicTest.vue b/pages/index/basicTest.vue index c7395bf..5038d05 100644 --- a/pages/index/basicTest.vue +++ b/pages/index/basicTest.vue @@ -25,7 +25,8 @@ data() { return { title: 'UTS基础语法', - result: {} + result: {}, + count: 0 } }, onReady() { @@ -49,7 +50,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; testKeepAlive((res) => { count++; @@ -59,7 +60,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; testKeepAliveOption({ a: "testKeepAliveOption", @@ -72,7 +73,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; TestKeepAliveClass.onTestStatic((res) => { count++; @@ -82,7 +83,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; TestKeepAliveClass.testKeepAliveStatic((res) => { count++; @@ -92,7 +93,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; TestKeepAliveClass.testKeepAliveOptionStatic({ a: "testKeepAliveOption", @@ -105,7 +106,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; const obj = new TestKeepAliveClass() obj.onTest((res) => { @@ -116,7 +117,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; obj.testKeepAlive((res) => { count++; @@ -126,7 +127,7 @@ if (count < 2) { ret = false } - count = 0; + // count = 0; obj.testKeepAliveOption({ a: "testKeepAliveOption", @@ -138,6 +139,9 @@ if (count < 2) { ret = false } + setTimeout(()=>{ + this.count = count + },10) return ret } } -- GitLab