test(affix): add test (#1504)

This commit is contained in:
songjianet 2021-11-03 01:21:48 +08:00 committed by GitHub
parent ca8475752b
commit 2a64db66eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,4 +45,21 @@ describe('n-affix', () => {
await makeScroll(document.documentElement, 'scrollTop', 200)
expect(wrapper.attributes('style')).toContain('top: 120px;')
})
it('should work with `position` prop', async () => {
const wrapper = mount(NAffix, {
props: {
position: 'absolute'
},
slots: {
default: () => {
return h('div', {}, 'content')
}
}
})
expect(wrapper.find('.n-affix--absolute-positioned').exists()).not.toBe(
null
)
})
})