提交 e212aa66 编写于 作者: 辛宝Otto's avatar 辛宝Otto 🥊

feat: 补充 canvas context 方法演示

上级 1cc28b29
...@@ -23,21 +23,20 @@ describe('Canvas.uvue', () => { ...@@ -23,21 +23,20 @@ describe('Canvas.uvue', () => {
expect(true).toBe(true) expect(true).toBe(true)
} }
}) })
it("测试异步方式", async () => { it("测试异步创建canvas上下文", async () => {
await page.callMethod('useAsync'); await page.callMethod('useAsync');
const { const element = await page.$('#testCanvasContext')
testCanvasContext, expect(await element.text()).toBe('true')
testToDataURLResult
} = await page.data() })
expect(testCanvasContext).toBe(true) it("测试同步创建canvas上下文", async () => {
await page.callMethod('canvasToDataURL'); await page.callMethod('useAsync');
expect(testToDataURLResult).toBe(true) const element = await page.$('#testCanvasContext')
expect(await element.text()).toBe('true')
}) })
it("测试同步方式", async () => { it('测试 canvasToDataURL', async () => {
await page.callMethod('useSync');
const data = await page.data()
expect(data.testCanvasContext).toBe(true)
await page.callMethod('canvasToDataURL'); await page.callMethod('canvasToDataURL');
expect(data.testToDataURLResult).toBe(true) const element = await page.$('#testToDataURLResult')
expect(await element.text()).toBe('true')
}) })
}) })
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册