未验证 提交 3eda9428 编写于 作者: O openharmony_ci 提交者: Gitee

!5774 testClearInterval 修复

Merge pull request !5774 from Nicklaus/master
......@@ -19,7 +19,7 @@ import router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium';
export default function basicabilityapi() {
describe('basicabilityapi', function () {
describe('basicabilityapi', function () {
let testResult;
let testResultFail;
let test;
......@@ -63,21 +63,25 @@ describe('basicabilityapi', function () {
it('testClearInterval', 0, async function(done) {
console.info('testClearInterval START');
let res = 0;
let testTimes = 5
let intervalID = -1;
let promise1 = new Promise((resolve, reject) => {
intervalID = setInterval(function () {
if(res === testTimes ){
clearInterval(intervalID);
}
res++;
console.info('testClearInterval res = ' + res);
resolve();
}, 100);
});
Promise.all([promise1]).then(() => {
let promise2 = new Promise((resolve, reject) => {
setTimeout(function () {
console.info('[clearInterval] start');
clearInterval(intervalID);
console.info('[clearInterval] end');
resolve();
}, 600);
});
Promise.all([promise1, promise2]).then(() => {
console.info('testClearInterval finally');
expect(testTimes).assertEqual(res);
expect(5).assertEqual(res);
console.info('testClearInterval END');
done();
});
......@@ -487,6 +491,7 @@ describe('basicabilityapi', function () {
}, 1000);
});
/**
* @tc.number SUB_ACE_BASICABILITY_JS_API_1500
* @tc.name testRequestAnimationFrame
......@@ -519,5 +524,5 @@ describe('basicabilityapi', function () {
done();
}, 1000);
});
});
});
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册