1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

change code structure

This commit is contained in:
lana-k
2021-05-04 14:13:58 +02:00
parent a07f2d3d99
commit cc483f4720
72 changed files with 297 additions and 311 deletions

View File

@@ -0,0 +1,46 @@
import { expect } from 'chai'
import { mount } from '@vue/test-utils'
import tooltipMixin from '@/tooltipMixin'
describe('tooltipMixin.js', () => {
it('tooltip is hidden in initial', () => {
const component = {
template: '<div :style="tooltipStyle"></div>',
mixins: [tooltipMixin]
}
const wrapper = mount(component)
expect(wrapper.find('div').isVisible()).to.equal(false)
})
it('tooltipStyle is correct when showTooltip', async () => {
const component = {
template: '<div :style="tooltipStyle"></div>',
mixins: [tooltipMixin]
}
const wrapper = mount(component)
await wrapper.vm.showTooltip(new MouseEvent('mouseover', {
clientX: 10,
clientY: 20
}))
expect(wrapper.vm.tooltipStyle).to.eql({
visibility: 'visible',
top: '8px',
left: '22px'
})
expect(wrapper.find('div').isVisible()).to.equal(true)
})
it('tooltip is not visible after hideTooltip', async () => {
const component = {
template: '<div :style="tooltipStyle"></div>',
mixins: [tooltipMixin]
}
const wrapper = mount(component)
await wrapper.vm.showTooltip(new MouseEvent('mouseover', {
clientX: 10,
clientY: 20
}))
await wrapper.vm.hideTooltip()
expect(wrapper.find('div').isVisible()).to.equal(false)
})
})