提交 30e9aa41 编写于 作者: X xdmal

Signed-off-by: xdmal <maxiaodong16@huawei.com>

Why
Modify the variable naming problem

Description
Variable names follow camel case

 On branch OpenHarmony-3.0-LTS
 Your branch is up to date with 'origin/OpenHarmony-3.0-LTS'.
上级 9318d1e6
...@@ -387,33 +387,33 @@ describe('workerTest', function () { ...@@ -387,33 +387,33 @@ describe('workerTest', function () {
it('worker_off_test_001', 0, function () { it('worker_off_test_001', 0, function () {
var ss = new worker.Worker("workers/worker.js"); var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0; var zhangsanTimes = 0;
ss.on("zhangsan", ()=>{ ss.on("zhangsan", ()=>{
zhangsan_times++; zhangsanTimes++;
}) })
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1) expect(zhangsanTimes).assertEqual(1)
ss.off("zhangsan") ss.off("zhangsan")
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1) expect(zhangsanTimes).assertEqual(1)
}) })
// check worker off function is ok // check worker off function is ok
it('worker_off_test_002', 0, function () { it('worker_off_test_002', 0, function () {
var ss = new worker.Worker("workers/worker.js"); var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0; var zhangsanTimes = 0;
ss.on("zhangsan", ()=>{ ss.on("zhangsan", ()=>{
zhangsan_times++; zhangsanTimes++;
}) })
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2) expect(zhangsanTimes).assertEqual(2)
for (var i=0;i<3;i++) for (var i=0;i<3;i++)
{ {
...@@ -421,40 +421,40 @@ describe('workerTest', function () { ...@@ -421,40 +421,40 @@ describe('workerTest', function () {
} }
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2) expect(zhangsanTimes).assertEqual(2)
}) })
// check worker removeEventListener function is ok // check worker removeEventListener function is ok
it('worker_removeListener_test_001', 0, function () { it('worker_removeListener_test_001', 0, function () {
var ss = new worker.Worker("workers/worker.js"); var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0; var zhangsanTimes = 0;
ss.addEventListener("zhangsan", ()=>{ ss.addEventListener("zhangsan", ()=>{
zhangsan_times++; zhangsanTimes++;
}) })
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1) expect(zhangsanTimes).assertEqual(1)
ss.removeEventListener("zhangsan") ss.removeEventListener("zhangsan")
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(1) expect(zhangsanTimes).assertEqual(1)
}) })
// check worker removeEventListener function is ok // check worker removeEventListener function is ok
it('worker_removeListener_test_002', 0, function () { it('worker_removeListener_test_002', 0, function () {
var ss = new worker.Worker("workers/worker.js"); var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0; var zhangsanTimes = 0;
ss.addEventListener("zhangsan", ()=>{ ss.addEventListener("zhangsan", ()=>{
zhangsan_times++; zhangsanTimes++;
}) })
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2) expect(zhangsanTimes).assertEqual(2)
for (var i=0;i<3;i++) for (var i=0;i<3;i++)
{ {
...@@ -462,39 +462,39 @@ describe('workerTest', function () { ...@@ -462,39 +462,39 @@ describe('workerTest', function () {
} }
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2) expect(zhangsanTimes).assertEqual(2)
}) })
// check worker removeAllListener function is ok // check worker removeAllListener function is ok
it('worker_removeListener_test_003', 0, function () { it('worker_removeListener_test_003', 0, function () {
var ss = new worker.Worker("workers/worker.js"); var ss = new worker.Worker("workers/worker.js");
var zhangsan_times = 0; var zhangsanTimes = 0;
ss.addEventListener("zhangsan", ()=>{ ss.addEventListener("zhangsan", ()=>{
zhangsan_times++; zhangsanTimes++;
}) })
var lisi_times = 0; var lisiTimes = 0;
ss.addEventListener("lisi", ()=>{ ss.addEventListener("lisi", ()=>{
lisi_times++; lisiTimes++;
}) })
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2) expect(zhangsanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"}) ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"}) ss.dispatchEvent({type: "lisi"})
expect(lisi_times).assertEqual(2) expect(lisiTimes).assertEqual(2)
ss.removeAllListener() ss.removeAllListener()
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
ss.dispatchEvent({type: "zhangsan"}) ss.dispatchEvent({type: "zhangsan"})
expect(zhangsan_times).assertEqual(2) expect(zhangsanTimes).assertEqual(2)
ss.dispatchEvent({type: "lisi"}) ss.dispatchEvent({type: "lisi"})
ss.dispatchEvent({type: "lisi"}) ss.dispatchEvent({type: "lisi"})
expect(lisi_times).assertEqual(2) expect(lisiTimes).assertEqual(2)
}) })
// check parentPort.close is ok // check parentPort.close is ok
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册