diff --git a/pages/CSS/background/background-image.test.js b/pages/CSS/background/background-image.test.js index e2a60d208ff7518c64256f69df8c26e68bcbef84..59f2850799a59e32e16470d0d11a61fc353cb2bd 100644 --- a/pages/CSS/background/background-image.test.js +++ b/pages/CSS/background/background-image.test.js @@ -8,14 +8,38 @@ describe('background-image-test', () => { it('background-image-screenshot', async () => { await page.waitFor(300); - const image = await program.screenshot({fullPage: true}); + const image = await program.screenshot({ + fullPage: true + }); expect(image).toSaveImageSnapshot(); }); it('background-image-select', async () => { await page.callMethod('updateBackgroundSelect') await page.waitFor(300); - const image = await program.screenshot({fullPage: true}); + const image = await program.screenshot({ + fullPage: true + }); expect(image).toSaveImageSnapshot(); }); + + it('动态切换 background color', async () => { + await page.callMethod('setBackgroundColor') + await page.waitFor(300); + const image = await program.screenshot({ + fullPage: true + }); + expect(image).toSaveImageSnapshot(); + + }) + it('动态切换 background color/image', async () => { + await page.callMethod('setBackgroundImage') + await page.waitFor(300); + + const image = await program.screenshot({ + fullPage: true + }); + expect(image).toSaveImageSnapshot(); + + }) }); diff --git a/pages/CSS/background/background-image.uvue b/pages/CSS/background/background-image.uvue index da5dcd1bd44f018f9c3cca9fdd9d779ac6282631..b56356f5ca7fe118e2d9bffcbb14b35e091777c3 100644 --- a/pages/CSS/background/background-image.uvue +++ b/pages/CSS/background/background-image.uvue @@ -2,15 +2,20 @@ - + - 不支持背景图片,仅支持linear-gradient方法 - - background-image: linear-gradient({{direction}}, red, yellow) - + 不支持背景图片,仅支持linear-gradient方法 + + background-image: linear-gradient({{direction}}, red, yellow) + - + + style 动态切换 background + + + @@ -18,24 +23,39 @@