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

test(v-bind): 增加 css v-bind rpx测试

上级 be566445
...@@ -54,6 +54,7 @@ type DataInfo = { ...@@ -54,6 +54,7 @@ type DataInfo = {
border : string border : string
fooProps : FooProps fooProps : FooProps
vBindClassBackgroundColor : string, vBindClassBackgroundColor : string,
vBindClassRpxHeight : string,
} }
const dataInfo = reactive({ const dataInfo = reactive({
...@@ -68,6 +69,7 @@ const dataInfo = reactive({ ...@@ -68,6 +69,7 @@ const dataInfo = reactive({
} }
}, },
vBindClassBackgroundColor: 'red', vBindClassBackgroundColor: 'red',
vBindClassRpxHeight: '300rpx'
} as DataInfo) } as DataInfo)
defineExpose({ defineExpose({
...@@ -79,7 +81,7 @@ defineExpose({ ...@@ -79,7 +81,7 @@ defineExpose({
/* #ifdef WEB */ /* #ifdef WEB */
.v-bind-css { .v-bind-css {
background-color: v-bind(dataInfo.vBindClassBackgroundColor); background-color: v-bind(dataInfo.vBindClassBackgroundColor);
height: 20px; height: v-bind(dataInfo.vBindClassRpxHeight);
} }
/* #endif */ /* #endif */
</style> </style>
...@@ -44,6 +44,7 @@ type DataInfo = { ...@@ -44,6 +44,7 @@ type DataInfo = {
border: string border: string
fooProps: FooProps fooProps: FooProps
vBindClassBackgroundColor: string vBindClassBackgroundColor: string
vBindClassRpxHeight: string
} }
export default { export default {
...@@ -61,7 +62,8 @@ export default { ...@@ -61,7 +62,8 @@ export default {
name: 'foo obj name' name: 'foo obj name'
} }
}, },
vBindClassBackgroundColor: 'red' vBindClassBackgroundColor: 'red',
vBindClassRpxHeight: '300rpx'
} as DataInfo } as DataInfo
} }
} }
...@@ -72,7 +74,7 @@ export default { ...@@ -72,7 +74,7 @@ export default {
/* #ifdef WEB */ /* #ifdef WEB */
.v-bind-css { .v-bind-css {
background-color: v-bind(dataInfo.vBindClassBackgroundColor); background-color: v-bind(dataInfo.vBindClassBackgroundColor);
height: 20px; height: v-bind(dataInfo.vBindClassRpxHeight);
} }
/* #endif */ /* #endif */
</style> </style>
...@@ -4,7 +4,6 @@ const COMPOSITION_PAGE_PATH = '/pages/directive/v-bind/v-bind-composition' ...@@ -4,7 +4,6 @@ const COMPOSITION_PAGE_PATH = '/pages/directive/v-bind/v-bind-composition'
describe('v-bind', () => { describe('v-bind', () => {
let page let page
const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase() const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const isIos = platformInfo.startsWith('ios')
const isWeb = platformInfo.startsWith('web') const isWeb = platformInfo.startsWith('web')
const isFirefox = platformInfo.indexOf('firefox') > -1 const isFirefox = platformInfo.indexOf('firefox') > -1
...@@ -50,6 +49,7 @@ describe('v-bind', () => { ...@@ -50,6 +49,7 @@ describe('v-bind', () => {
if (isWeb) { if (isWeb) {
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')
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册