From 9f3821e1e5ef0f2d8c26f0cc5f97419eba215548 Mon Sep 17 00:00:00 2001 From: jixinbao Date: Fri, 26 Jul 2024 19:43:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20createCanvasContextAsync=20=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=94=AF=E6=8C=81=E5=AE=89=E5=8D=93=E3=80=81web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../child-canvas.uvue | 35 +++++++------- .../create-canvas-context-async.test.js | 47 ++++++++----------- .../create-canvas-context-async.uvue | 35 +++++++------- 3 files changed, 52 insertions(+), 65 deletions(-) diff --git a/pages/API/create-canvas-context-async/child-canvas.uvue b/pages/API/create-canvas-context-async/child-canvas.uvue index 3b76215d..408d89a7 100644 --- a/pages/API/create-canvas-context-async/child-canvas.uvue +++ b/pages/API/create-canvas-context-async/child-canvas.uvue @@ -1,44 +1,41 @@ + \ No newline at end of file diff --git a/pages/API/create-canvas-context-async/create-canvas-context-async.test.js b/pages/API/create-canvas-context-async/create-canvas-context-async.test.js index 7eef070d..8b06db93 100644 --- a/pages/API/create-canvas-context-async/create-canvas-context-async.test.js +++ b/pages/API/create-canvas-context-async/create-canvas-context-async.test.js @@ -1,32 +1,25 @@ const PAGE_PATH = '/pages/API/create-canvas-context-async/create-canvas-context-async' describe('create-canvas-context-async', () => { - if (!process.env.uniTestPlatformInfo.toLowerCase().startsWith('ios')) { - it('ios only', () => { - expect(1).toBe(1) - }) - return - } - let page - beforeAll(async () => { - page = await program.reLaunch(PAGE_PATH) - await page.waitFor('view') - }) + let page + beforeAll(async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor('view') + }) - it('page canvas', async () => { - await page.waitFor(100) - const data = await page.callMethod('getContext') - expect(data.ctx).toBe('object') - expect(data.hasFillRect).toBe(true) - }) + it('page canvas', async () => { + await page.waitFor(100) + const data = await page.data() + expect(data.isCanvasContextNull).toBe(true) + }) - it('component canvas', async () => { - // child-canvas - await page.waitFor(100) - // const element = await page.$('.node-child-component') - const element = await page.$('child-canvas') - const data = await page.callMethod('getContext') - expect(data.ctx).toBe('object') - expect(data.hasFillRect).toBe(true) - }) -}) + it('component canvas', async () => { + // child-canvas + await page.waitFor(100) + // const element = await page.$('.node-child-component') + const element = await page.$('child-canvas') + const data = await page.data() + expect(data.isCanvasContextNull).toBe(true) + + }) +}) \ No newline at end of file diff --git a/pages/API/create-canvas-context-async/create-canvas-context-async.uvue b/pages/API/create-canvas-context-async/create-canvas-context-async.uvue index 9805decf..27f3aa3b 100644 --- a/pages/API/create-canvas-context-async/create-canvas-context-async.uvue +++ b/pages/API/create-canvas-context-async/create-canvas-context-async.uvue @@ -2,48 +2,45 @@ create canvas context async - + isCanvasContextNull: {{isCanvasContextNull}} + \ No newline at end of file -- GitLab