提交 0d1ea412 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test(v-bind): 补充 object prop 测试

上级 11a1b744
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<view> <view>
<text class="count-id">{{id}}</text> <text class="count-id">{{id}}</text>
<text class="count-title">{{title}}</text> <text class="count-title">{{title}}</text>
<text class="count-obj">{{obj!['name']}}</text>
</view> </view>
</template> </template>
...@@ -15,6 +16,9 @@ ...@@ -15,6 +16,9 @@
title: { title: {
type: String, type: String,
default: '' default: ''
},
obj: {
type: Object as PropType<UTSJSONObject>
} }
} }
} }
......
...@@ -9,8 +9,10 @@ describe('v-bind-props', () => { ...@@ -9,8 +9,10 @@ describe('v-bind-props', () => {
it('counter1', async () => { it('counter1', async () => {
const counter = await page.$('.counter1') const counter = await page.$('.counter1')
const counterID = await counter.$('.count-id') const counterID = await counter.$('.count-id')
const counterTitle = await counter.$('.count-title')
expect(await counterID.text()).toBe('1') expect(await counterID.text()).toBe('1')
const counterTitle = await counter.$('.count-title')
expect(await counterTitle.text()).toBe('title') expect(await counterTitle.text()).toBe('title')
const counterObj = await counter.$('.count-obj')
expect(await counterObj.text()).toBe('obj prop name')
}) })
}) })
\ No newline at end of file
<template> <template>
<view class="page"> <view class="page">
<view class="split-title">v-bind-props</view> <view class="split-title">v-bind-props</view>
<counter class="counter1" :id="post.id" :title="post.title"></counter> <counter class="counter1" :id="post.id" :title="post.title" :obj="{name: 'obj prop name'}"></counter>
<!-- TODO 暂不支持 --> <!-- TODO 暂不支持 -->
<!-- <counter class="counter2" v-bind="post"></counter> --> <!-- <counter class="counter2" v-bind="post"></counter> -->
</view> </view>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册