mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-24 11:05:17 +08:00
fix(card): fix the bug that bodyStyle
can not accept Object and Array (#754)
* fix(card): fix the bug that `bodyStyle` can not accept Object and Array * test(card): add 'bodyStyle' test case
This commit is contained in:
parent
bd4cb60cc6
commit
20db02efe9
@ -55,6 +55,32 @@ describe('Card.vue', () => {
|
||||
expect(wrapper.find('.el-card__body').attributes('style')).toBe(style)
|
||||
})
|
||||
|
||||
test('body style with object', () => {
|
||||
const style = { 'font-size': '14px' }
|
||||
const wrapper = mount(Card, {
|
||||
props: {
|
||||
slots: {
|
||||
default: AXIOM,
|
||||
},
|
||||
bodyStyle: style,
|
||||
},
|
||||
})
|
||||
expect(wrapper.find('.el-card__body').attributes('style')).toBe('font-size: 14px;')
|
||||
})
|
||||
|
||||
test('body style with array', () => {
|
||||
const style = [{ 'font-size': '14px' }, { color: 'blue' }]
|
||||
const wrapper = mount(Card, {
|
||||
props: {
|
||||
slots: {
|
||||
default: AXIOM,
|
||||
},
|
||||
bodyStyle: style,
|
||||
},
|
||||
})
|
||||
expect(wrapper.find('.el-card__body').attributes('style').replace(/[ ]/g, '')).toBe('font-size:14px;color:blue;')
|
||||
})
|
||||
|
||||
test('shadow', () => {
|
||||
const shadow = 'test-shadow'
|
||||
const wrapper = mount(Card, {
|
||||
|
@ -20,7 +20,7 @@ export default defineComponent({
|
||||
default: '',
|
||||
},
|
||||
bodyStyle: {
|
||||
type: String,
|
||||
type: [String, Object, Array],
|
||||
default: '',
|
||||
},
|
||||
shadow: {
|
||||
|
Loading…
Reference in New Issue
Block a user