mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
format
This commit is contained in:
@@ -24,17 +24,20 @@ describe('tooltipMixin.js', () => {
|
||||
|
||||
it('tooltipStyle is correct when showTooltip: top-right', async () => {
|
||||
const component = {
|
||||
template: '<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
template:
|
||||
'<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
mixins: [tooltipMixin]
|
||||
}
|
||||
|
||||
const wrapper = mount(component, { attachTo: container })
|
||||
|
||||
// by default top-right
|
||||
await wrapper.vm.showTooltip(new MouseEvent('mouseenter', {
|
||||
clientX: 10,
|
||||
clientY: 20
|
||||
}))
|
||||
await wrapper.vm.showTooltip(
|
||||
new MouseEvent('mouseenter', {
|
||||
clientX: 10,
|
||||
clientY: 20
|
||||
})
|
||||
)
|
||||
expect(wrapper.vm.tooltipStyle).to.eql({
|
||||
visibility: 'visible',
|
||||
top: '8px',
|
||||
@@ -45,15 +48,19 @@ describe('tooltipMixin.js', () => {
|
||||
|
||||
it('tooltipStyle is correct when showTooltip: top-left', async () => {
|
||||
const component = {
|
||||
template: '<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
template:
|
||||
'<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
mixins: [tooltipMixin]
|
||||
}
|
||||
const wrapper = mount(component, { attachTo: container })
|
||||
|
||||
await wrapper.vm.showTooltip(new MouseEvent('mouseenter', {
|
||||
clientX: 212,
|
||||
clientY: 20
|
||||
}), 'top-left')
|
||||
await wrapper.vm.showTooltip(
|
||||
new MouseEvent('mouseenter', {
|
||||
clientX: 212,
|
||||
clientY: 20
|
||||
}),
|
||||
'top-left'
|
||||
)
|
||||
|
||||
expect(wrapper.vm.tooltipStyle).to.eql({
|
||||
visibility: 'visible',
|
||||
@@ -66,15 +73,19 @@ describe('tooltipMixin.js', () => {
|
||||
|
||||
it('tooltipStyle is correct when showTooltip: bottom-right', async () => {
|
||||
const component = {
|
||||
template: '<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
template:
|
||||
'<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
mixins: [tooltipMixin]
|
||||
}
|
||||
const wrapper = mount(component, { attachTo: container })
|
||||
|
||||
await wrapper.vm.showTooltip(new MouseEvent('mouseenter', {
|
||||
clientX: 10,
|
||||
clientY: 20
|
||||
}), 'bottom-right')
|
||||
await wrapper.vm.showTooltip(
|
||||
new MouseEvent('mouseenter', {
|
||||
clientX: 10,
|
||||
clientY: 20
|
||||
}),
|
||||
'bottom-right'
|
||||
)
|
||||
expect(wrapper.vm.tooltipStyle).to.eql({
|
||||
visibility: 'visible',
|
||||
top: '32px',
|
||||
@@ -85,15 +96,19 @@ describe('tooltipMixin.js', () => {
|
||||
|
||||
it('tooltipStyle is correct when showTooltip: bottom-left', async () => {
|
||||
const component = {
|
||||
template: '<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
template:
|
||||
'<div :style="{...tooltipStyle, width: \'100px\'}" ref="tooltip"></div>',
|
||||
mixins: [tooltipMixin]
|
||||
}
|
||||
const wrapper = mount(component, { attachTo: container })
|
||||
|
||||
await wrapper.vm.showTooltip(new MouseEvent('mouseenter', {
|
||||
clientX: 212,
|
||||
clientY: 20
|
||||
}), 'bottom-left')
|
||||
await wrapper.vm.showTooltip(
|
||||
new MouseEvent('mouseenter', {
|
||||
clientX: 212,
|
||||
clientY: 20
|
||||
}),
|
||||
'bottom-left'
|
||||
)
|
||||
|
||||
expect(wrapper.vm.tooltipStyle).to.eql({
|
||||
visibility: 'visible',
|
||||
@@ -109,10 +124,12 @@ describe('tooltipMixin.js', () => {
|
||||
mixins: [tooltipMixin]
|
||||
}
|
||||
const wrapper = mount(component, { attachTo: container })
|
||||
await wrapper.vm.showTooltip(new MouseEvent('mouseenter', {
|
||||
clientX: 10,
|
||||
clientY: 20
|
||||
}))
|
||||
await wrapper.vm.showTooltip(
|
||||
new MouseEvent('mouseenter', {
|
||||
clientX: 10,
|
||||
clientY: 20
|
||||
})
|
||||
)
|
||||
await wrapper.vm.hideTooltip()
|
||||
expect(wrapper.find('div').isVisible()).to.equal(false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user