未验证 提交 362cd0dc 编写于 作者: O openharmony_ci 提交者: Gitee

!5775 testClearInterval 修复 beta3

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