提交 380ce2ef 编写于 作者: F fxy060608

新增setup非响应式数据绑定style测试例 #16699

上级 09f691c2
...@@ -22,6 +22,13 @@ ...@@ -22,6 +22,13 @@
<view>bind arr style</view> <view>bind arr style</view>
<view class="my-10">{{ dataInfo.backgroundColor }}</view> <view class="my-10">{{ dataInfo.backgroundColor }}</view>
<view>{{ dataInfo.border }}</view> <view>{{ dataInfo.border }}</view>
</view>
<view class="mb-10 p-10">
<text id="bind-raw-object-style" :style="rawObjectStyle">rawObjectStyle</text>
</view>
<!-- 目前仅android平台在内部重新调用了normalizeStyle,其他端暂时没有,这应该是vue的bug -->
<view class="mb-10 p-10">
<text id="bind-raw-array-style" :style="rawArrayStyle">rawArrayStyle</text>
</view> </view>
<!-- v-bind props --> <!-- v-bind props -->
...@@ -82,7 +89,23 @@ ...@@ -82,7 +89,23 @@
const fooProps = reactive({ const fooProps = reactive({
title: 'foo title(json)', title: 'foo title(json)',
num: 2, num: 2,
}) })
const rawObjectStyle = {
width: '100%',
height: '30px',
'background-color': 'red'
}
const rawArrayStyle = [
{
width: '100%',
height: '30px'
},
{
'background-color': 'red'
}
]
defineExpose({ defineExpose({
dataInfo dataInfo
......
...@@ -18,6 +18,12 @@ ...@@ -18,6 +18,12 @@
<view>bind arr style</view> <view>bind arr style</view>
<view class="my-10">{{ dataInfo.backgroundColor }}</view> <view class="my-10">{{ dataInfo.backgroundColor }}</view>
<view>{{ dataInfo.border }}</view> <view>{{ dataInfo.border }}</view>
</view>
<view class="mb-10 p-10">
<text id="bind-raw-object-style" :style="rawObjectStyle">rawObjectStyle</text>
</view>
<view class="mb-10 p-10">
<text id="bind-raw-array-style" :style="rawArrayStyle">rawArrayStyle</text>
</view> </view>
<!-- v-bind props --> <!-- v-bind props -->
...@@ -85,7 +91,21 @@ ...@@ -85,7 +91,21 @@
fooProps:{ fooProps:{
title: 'foo title(json)', title: 'foo title(json)',
num: 2, num: 2,
} },
rawObjectStyle: {
width: '100%',
height: '30px',
'background-color': 'red'
},
rawArrayStyle: [
{
width: '100%',
height: '30px'
},
{
'background-color': 'red'
}
]
} }
} }
} }
......
...@@ -66,7 +66,11 @@ describe('v-bind', () => { ...@@ -66,7 +66,11 @@ describe('v-bind', () => {
const vBindCss = await page.$('.v-bind-css') const vBindCss = await page.$('.v-bind-css')
expect(await vBindCss.style('backgroundColor')).toBe('rgb(255, 0, 0)') expect(await vBindCss.style('backgroundColor')).toBe('rgb(255, 0, 0)')
expect(await vBindCss.style('height')).toBe('150px') expect(await vBindCss.style('height')).toBe('150px')
} }
const bindRawObjectStyle = await page.$('#bind-raw-object-style')
expect(await bindRawObjectStyle.text()).toBe("rawObjectStyle")
const bindRawArrayStyle = await page.$('#bind-raw-array-style')
expect(await bindRawArrayStyle.text()).toBe("rawArrayStyle")
} }
it('v-bind options API', async () => { it('v-bind options API', async () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册