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) await trigger.trigger(CLICK_EVENT)
expect(popper.vm.visibility).toBe(false) 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, $slots,
appendToBody, appendToBody,
class: kls, class: kls,
style,
effect, effect,
hide, hide,
onPopperMouseEnter, onPopperMouseEnter,
@ -103,6 +104,7 @@ export default defineComponent({
const triggerProps = { const triggerProps = {
ariaDescribedby: popperId, ariaDescribedby: popperId,
class: kls, class: kls,
style,
ref: 'triggerRef', ref: 'triggerRef',
...this.events, ...this.events,
} }

View File

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