Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0e1c427b
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0e1c427b
编写于
8月 04, 2022
作者:
Z
zhijianwen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
emitter++
Signed-off-by:
N
zhijianwen
<
zhijianwen@huawei.com
>
上级
35d7f675
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
23 addition
and
23 deletion
+23
-23
notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js
...ibeandpublish/emittertest/src/main/js/test/EmitterTest.js
+23
-23
未找到文件。
notification/ces_standard/subscribeandpublish/emittertest/src/main/js/test/EmitterTest.js
浏览文件 @
0e1c427b
...
...
@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import
e
vents_e
mitter
from
'
@ohos.events.emitter
'
import
emitter
from
'
@ohos.events.emitter
'
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
@ohos/hypium
'
export
default
function
EmitterTest
()
{
...
...
@@ -53,21 +53,21 @@ export default function EmitterTest() {
/*
* @tc.number : EmitterTest_0100
* @tc.name : verify on : on(event: InnerEvent, callback: Callback<EventData>): void
* @tc.desc : e
vents_e
mitter.EventPriority.IDLE
* @tc.desc : emitter.EventPriority.IDLE
*/
it
(
'
EmitterTest_0100
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
EmitterTest_0100 START
'
)
innerEvent
.
eventId
=
1
innerEvent
.
priority
=
e
vents_e
mitter
.
EventPriority
.
IDLE
innerEvent
.
priority
=
emitter
.
EventPriority
.
IDLE
eventData
.
data
.
id
=
0
eventData
.
data
.
content
=
'
message_0
'
e
vents_e
mitter
.
on
(
innerEvent
,
EmitterCallback
)
e
vents_e
mitter
.
emit
(
innerEvent
,
eventData
)
emitter
.
on
(
innerEvent
,
EmitterCallback
)
emitter
.
emit
(
innerEvent
,
eventData
)
eventData
.
data
.
id
=
1
eventData
.
data
.
content
=
'
message_1
'
e
vents_e
mitter
.
emit
(
innerEvent
,
eventData
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
TAG
+
'
EmitterTest_0100 END
'
)
done
()
})
...
...
@@ -75,18 +75,18 @@ export default function EmitterTest() {
/*
* @tc.number : EmitterTest_0200
* @tc.name : verify on : once(event: InnerEvent, callback: Callback<EventData>): void
* @tc.desc : e
vents_e
mitter.EventPriority.LOW
* @tc.desc : emitter.EventPriority.LOW
*/
it
(
'
EmitterTest_0200
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
EmitterTest_0200 START
'
)
innerEvent
.
eventId
=
2
innerEvent
.
priority
=
e
vents_e
mitter
.
EventPriority
.
LOW
innerEvent
.
priority
=
emitter
.
EventPriority
.
LOW
eventData
.
data
.
id
=
2
eventData
.
data
.
content
=
'
message_2
'
e
vents_e
mitter
.
once
(
innerEvent
,
EmitterCallback
)
e
vents_e
mitter
.
emit
(
innerEvent
,
eventData
)
emitter
.
once
(
innerEvent
,
EmitterCallback
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
TAG
+
'
EmitterTest_0200 END
'
)
done
()
})
...
...
@@ -94,18 +94,18 @@ export default function EmitterTest() {
/*
* @tc.number : EmitterTest_0300
* @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void
* @tc.desc : e
vents_e
mitter.EventPriority.HIGH
* @tc.desc : emitter.EventPriority.HIGH
*/
it
(
'
EmitterTest_0300
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
EmitterTest_0300 START
'
)
innerEvent
.
eventId
=
3
innerEvent
.
priority
=
e
vents_e
mitter
.
EventPriority
.
HIGH
innerEvent
.
priority
=
emitter
.
EventPriority
.
HIGH
eventData
.
data
.
id
=
3
eventData
.
data
.
content
=
'
message_3
'
e
vents_e
mitter
.
once
(
innerEvent
,
EmitterCallback
)
e
vents_e
mitter
.
emit
(
innerEvent
,
eventData
)
emitter
.
once
(
innerEvent
,
EmitterCallback
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
TAG
+
'
EmitterTest_0300 END
'
)
done
()
})
...
...
@@ -113,18 +113,18 @@ export default function EmitterTest() {
/*
* @tc.number : EmitterTest_0400
* @tc.name : verify on : emit(event: InnerEvent, data?: EventData): void
* @tc.desc : e
vents_e
mitter.EventPriority.IMMEDIATE
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
EmitterTest_0400
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
EmitterTest_0400 START
'
)
innerEvent
.
eventId
=
4
innerEvent
.
priority
=
e
vents_e
mitter
.
EventPriority
.
IMMEDIATE
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
4
eventData
.
data
.
content
=
'
message_4
'
e
vents_e
mitter
.
once
(
innerEvent
,
EmitterCallback
)
e
vents_e
mitter
.
emit
(
innerEvent
,
eventData
)
emitter
.
once
(
innerEvent
,
EmitterCallback
)
emitter
.
emit
(
innerEvent
,
eventData
)
console
.
info
(
TAG
+
'
EmitterTest_0400 END
'
)
done
()
})
...
...
@@ -132,19 +132,19 @@ export default function EmitterTest() {
/*
* @tc.number : EmitterTest_0500
* @tc.name : verify on : off(eventId: number): void
* @tc.desc : e
vents_e
mitter.EventPriority.IMMEDIATE
* @tc.desc : emitter.EventPriority.IMMEDIATE
*/
it
(
'
EmitterTest_0500
'
,
0
,
async
function
(
done
)
{
console
.
info
(
TAG
+
'
EmitterTest_0500 START
'
)
innerEvent
.
eventId
=
5
innerEvent
.
priority
=
e
vents_e
mitter
.
EventPriority
.
IMMEDIATE
innerEvent
.
priority
=
emitter
.
EventPriority
.
IMMEDIATE
eventData
.
data
.
id
=
5
eventData
.
data
.
content
=
'
message_5
'
e
vents_e
mitter
.
once
(
innerEvent
,
EmitterCallback
)
e
vents_e
mitter
.
emit
(
innerEvent
,
eventData
)
e
vents_e
mitter
.
off
(
5
)
emitter
.
once
(
innerEvent
,
EmitterCallback
)
emitter
.
emit
(
innerEvent
,
eventData
)
emitter
.
off
(
5
)
console
.
info
(
TAG
+
'
EmitterTest_0500 END
'
)
done
()
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录