fix(popper): attr style fallthrough failed (#897)

This commit is contained in:
Simona 2020-12-08 21:01:16 +08:00 committed by GitHub
parent 158c4f9766
commit fabb9d5f03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -407,5 +407,19 @@ describe('Popper.vue', () => {
await trigger.trigger(CLICK_EVENT)
expect(popper.vm.visibility).toBe(false)
})
test('should pass style and class to trigger', async () => {
const CLASS = 'fake'
const STYLE = 'width: 100px'
const wrapper = _mount({
appendToBody: false,
class: CLASS,
style: STYLE,
})
const trigger = wrapper.find(`.${TEST_TRIGGER}`)
expect(trigger.classes(CLASS)).toBe(true)
expect((trigger.element as HTMLDivElement).style.width).toBe('100px')
})
})
})

View File

@ -53,6 +53,7 @@ export default defineComponent({
$slots,
appendToBody,
class: kls,
style,
effect,
hide,
onPopperMouseEnter,
@ -103,6 +104,7 @@ export default defineComponent({
const triggerProps = {
ariaDescribedby: popperId,
class: kls,
style,
ref: 'triggerRef',
...this.events,
}

View File

@ -62,6 +62,7 @@ export default {
type: String,
default: '',
},
style: Object,
closeDelay: {
type: Number,
default: 200,