diff --git a/pages/index/basicTest.test.js b/pages/index/basicTest.test.js index 63a9eb6388bab0187ebd9b923294069bfef6c55c..e63897d5f907c3abfcc8dc83527af2094ca96b80 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 c7395bfb7dcf3db650e08a7acc20701fbceb0f12..5038d05db7c2c702af6e246355e7cbda852b429b 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 } }