mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-03 12:48:45 +08:00
Added clickoutside drag-click test
This commit is contained in:
parent
9c13b0e8d5
commit
220f1542ea
@ -1,7 +1,7 @@
|
||||
import Clickoutside from 'element-ui/src/utils/clickoutside';
|
||||
const ctx = '@@clickoutsideContext';
|
||||
|
||||
import { triggerClick } from '../util';
|
||||
import { triggerEvent, triggerClick } from '../util';
|
||||
|
||||
describe('Utils:Clickoutside', () => {
|
||||
it('create', () => {
|
||||
@ -146,4 +146,25 @@ describe('Utils:Clickoutside', () => {
|
||||
triggerClick(document);
|
||||
expect(count).to.equal(1);
|
||||
});
|
||||
|
||||
it('stays open on drag click', () => {
|
||||
const el = document.createElement('div');
|
||||
const insideElm = document.createElement('div');
|
||||
let count = 0;
|
||||
const vnode = {
|
||||
context: {
|
||||
handleClick: () => ++count
|
||||
}
|
||||
};
|
||||
const binding = {
|
||||
expression: 'handleClick'
|
||||
};
|
||||
|
||||
el.appendChild(insideElm);
|
||||
Clickoutside.bind(el, binding, vnode);
|
||||
triggerEvent(insideElm, 'mousedown');
|
||||
triggerEvent(document, 'mouseup');
|
||||
expect(count).to.equal(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user