mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-04 13:17:47 +08:00
Tooltip: Improve hover test (#581)
This commit is contained in:
parent
ac207dc971
commit
718356a67e
@ -10,29 +10,21 @@ describe('Tooltip', () => {
|
|||||||
expect(vm.$el.querySelector('.el-tooltip__popper')).to.have.property('textContent', '提示文字');
|
expect(vm.$el.querySelector('.el-tooltip__popper')).to.have.property('textContent', '提示文字');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('hover', done => {
|
describe('hover', () => {
|
||||||
const vm = createVue(`
|
const vm = createVue(`
|
||||||
<el-tooltip ref="tooltip" content="提示文字">
|
<el-tooltip ref="tooltip" content="提示文字">
|
||||||
<button>click</button>
|
<button>click</button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
`, true);
|
`);
|
||||||
const tooltip = vm.$refs.tooltip;
|
const tooltip = vm.$refs.tooltip;
|
||||||
|
|
||||||
// trigger mouseenter
|
|
||||||
tooltip.handleShowPopper();
|
tooltip.handleShowPopper();
|
||||||
|
it('popperElm is exist', () => expect(tooltip.popperElm).to.exist);
|
||||||
expect(tooltip.popperElm).to.not.exist;
|
it('showPopper is true', () => expect(tooltip.showPopper).to.true);
|
||||||
setTimeout(_ => {
|
it('close popper', () => {
|
||||||
expect(tooltip).to.have.deep.property('popperElm.style.display').not.equal('none');
|
|
||||||
|
|
||||||
// trigger mouseleave
|
|
||||||
tooltip.handleClosePopper();
|
tooltip.handleClosePopper();
|
||||||
|
expect(tooltip.showPopper).to.false;
|
||||||
setTimeout(_ => {
|
});
|
||||||
expect(tooltip).to.have.deep.property('popperElm.style.display', 'none');
|
|
||||||
done();
|
|
||||||
}, 500);
|
|
||||||
}, 150);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('light mode', () => {
|
it('light mode', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user