提交 78f20dcb 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test(render function): 优化 cloneVNode 测试例

上级 30c71219
...@@ -2,9 +2,11 @@ const OPTIONS_PAGE_PATH = '/pages/render-function/cloneVNode/cloneVNode-options' ...@@ -2,9 +2,11 @@ const OPTIONS_PAGE_PATH = '/pages/render-function/cloneVNode/cloneVNode-options'
const COMPOSITION_PAGE_PATH = '/pages/render-function/cloneVNode/cloneVNode-composition' const COMPOSITION_PAGE_PATH = '/pages/render-function/cloneVNode/cloneVNode-composition'
describe('cloneVNode', () => { describe('cloneVNode', () => {
if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios')) { const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
// TODO: ios options API 合并属性无效, composition API 页面空白(defineOptions + render) const isWeb = platformInfo.startsWith('web')
it("IOS platform not support", async () => { const isIos = platformInfo.startsWith('ios')
if (isWeb) {
it("web platform test cannot get render dom", async () => {
expect(1).toBe(1); expect(1).toBe(1);
}); });
return return
...@@ -13,11 +15,16 @@ describe('cloneVNode', () => { ...@@ -13,11 +15,16 @@ describe('cloneVNode', () => {
let page = null let page = null
const test = async (pagePath) => { const test = async (pagePath) => {
page = await program.reLaunch(pagePath) page = await program.reLaunch(pagePath)
// 因为 web 端无法获取, 未使用 waitFor view await page.waitFor('view')
await page.waitFor(1000)
const image = await program.screenshot(); const original = await page.$('.original')
expect(image).toSaveImageSnapshot(); expect(await original.style('backgroundColor')).toBe('#ff0000')
if (!isIos) {
// ios options API 合并属性无效
const cloned = await page.$('.cloned')
expect(await cloned.style('backgroundColor')).toBe('#00ff00')
}
} }
it('cloneVNode options API', async () => { it('cloneVNode options API', async () => {
...@@ -25,6 +32,11 @@ describe('cloneVNode', () => { ...@@ -25,6 +32,11 @@ describe('cloneVNode', () => {
}) })
it('cloneVNode composition API', async () => { it('cloneVNode composition API', async () => {
if (!isIos) {
await test(COMPOSITION_PAGE_PATH) await test(COMPOSITION_PAGE_PATH)
} else {
// TODO: ios 端 defineOptions + render 页面空白
expect(1).toBe(1);
}
}) })
}) })
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册