提交 2861ea2f 编写于 作者: H hdx

feat(AnimationFrame): 合并 requestAnimationFrame/cancelAnimationFrame 为一个页面

上级 25d882b0
......@@ -546,17 +546,10 @@
}
},
{
"path": "pages/API/request-animation-frame/request-animation-frame",
"path": "pages/API/animation-frame/animation-frame",
"group": "1,4,9,0",
"style": {
"navigationBarTitleText": "requestAnimationFrame | 加入请求帧动画队列"
}
},
{
"path": "pages/API/cancel-animation-frame/cancel-animation-frame",
"group": "1,4,9,1",
"style": {
"navigationBarTitleText": "cancelAnimationFrame | 取消已加入的帧动画队列"
"navigationBarTitleText": "AnimationFrame | 帧动画"
}
},
{
......@@ -2740,4 +2733,4 @@
]
}
]
}
\ No newline at end of file
}
const PAGE_PATH = '/pages/API/cancel-animation-frame/cancel-animation-frame'
const PAGE_PATH = '/pages/API/animation-frame/animation-frame'
describe('API-cancelAnimationFrame', () => {
let page
......
const PAGE_PATH = '/pages/API/request-animation-frame/request-animation-frame'
describe('API-requestAnimationFrame', () => {
let page
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(600);
});
it('requestAnimationFrame', async () => {
await page.callMethod('startRequestAnimationFrame')
await page.waitFor(100)
const data = await page.data()
expect(data.testFrameCount > 0).toBe(true)
});
});
<template>
<view class="page">
<page-head :title="title"></page-head>
<button @click="startRequestAnimationFrame">requestAnimationFrame</button>
<text class="frame-count">{{testFrameCount}}</text>
</view>
</template>
<script>
export default {
data() {
return {
title: 'requestAnimationFrame',
testFrameCount: 0
}
},
methods: {
startRequestAnimationFrame() {
requestAnimationFrame((_ : number) => {
this.testFrameCount++;
})
}
}
}
</script>
<style>
.page {
padding: 15px;
}
.frame-count {
margin-top: 15px;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册