提交 81569837 编写于 作者: F fxy060608

chore: 调整KeepAlive测试例

上级 a73566be
...@@ -58,7 +58,9 @@ if (process.env.UNI_PROJECT_TYPE === '1.0' && (process.env.uniTestPlatformInfo.t ...@@ -58,7 +58,9 @@ if (process.env.UNI_PROJECT_TYPE === '1.0' && (process.env.uniTestPlatformInfo.t
describe('testCallbackKeepAlive', () => { describe('testCallbackKeepAlive', () => {
it("jest_testCallbackKeepAlive", async () => { it("jest_testCallbackKeepAlive", async () => {
const res = await page.callMethod('jest_testCallbackKeepAlive') 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
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
data() { data() {
return { return {
title: 'UTS基础语法', title: 'UTS基础语法',
result: {} result: {},
count: 0
} }
}, },
onReady() { onReady() {
...@@ -49,7 +50,7 @@ ...@@ -49,7 +50,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
testKeepAlive((res) => { testKeepAlive((res) => {
count++; count++;
...@@ -59,7 +60,7 @@ ...@@ -59,7 +60,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
testKeepAliveOption({ testKeepAliveOption({
a: "testKeepAliveOption", a: "testKeepAliveOption",
...@@ -72,7 +73,7 @@ ...@@ -72,7 +73,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
TestKeepAliveClass.onTestStatic((res) => { TestKeepAliveClass.onTestStatic((res) => {
count++; count++;
...@@ -82,7 +83,7 @@ ...@@ -82,7 +83,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
TestKeepAliveClass.testKeepAliveStatic((res) => { TestKeepAliveClass.testKeepAliveStatic((res) => {
count++; count++;
...@@ -92,7 +93,7 @@ ...@@ -92,7 +93,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
TestKeepAliveClass.testKeepAliveOptionStatic({ TestKeepAliveClass.testKeepAliveOptionStatic({
a: "testKeepAliveOption", a: "testKeepAliveOption",
...@@ -105,7 +106,7 @@ ...@@ -105,7 +106,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
const obj = new TestKeepAliveClass() const obj = new TestKeepAliveClass()
obj.onTest((res) => { obj.onTest((res) => {
...@@ -116,7 +117,7 @@ ...@@ -116,7 +117,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
obj.testKeepAlive((res) => { obj.testKeepAlive((res) => {
count++; count++;
...@@ -126,7 +127,7 @@ ...@@ -126,7 +127,7 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
count = 0; // count = 0;
obj.testKeepAliveOption({ obj.testKeepAliveOption({
a: "testKeepAliveOption", a: "testKeepAliveOption",
...@@ -138,6 +139,9 @@ ...@@ -138,6 +139,9 @@
if (count < 2) { if (count < 2) {
ret = false ret = false
} }
setTimeout(()=>{
this.count = count
},10)
return ret return ret
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册