Added clickoutside drag-click test

This commit is contained in:
Nicolaj Egelund 2017-03-12 21:16:42 +01:00 committed by 杨奕
parent 9c13b0e8d5
commit 220f1542ea

View File

@ -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);
});
});