Dropdown: click open uses show-timeout attribute (#8734)

* Dropdown: Click open uses `show-timeout` attribute

* Dropdown: Modified test to work with `show-timeout` attribute

* Dropdown: Clean up in testfix
This commit is contained in:
Johan Hernefeldt 2017-12-10 10:42:08 +01:00 committed by 杨奕
parent 0f7dcb9d32
commit 8ae2defa2d
2 changed files with 7 additions and 4 deletions

View File

@ -128,7 +128,11 @@
}, },
handleClick() { handleClick() {
if (this.triggerElm.disabled) return; if (this.triggerElm.disabled) return;
this.visible = !this.visible; if (this.visible) {
this.hide();
} else {
this.show();
}
}, },
handleTriggerKeyDown(ev) { handleTriggerKeyDown(ev) {
const keyCode = ev.keyCode; const keyCode = ev.keyCode;

View File

@ -102,12 +102,11 @@ describe('Dropdown', () => {
triggerEvent(triggerElm, 'mouseenter'); triggerEvent(triggerElm, 'mouseenter');
dropdown.$nextTick(_ => { dropdown.$nextTick(_ => {
expect(dropdown.visible).to.not.true; expect(dropdown.visible).to.not.true;
triggerElm.click(); triggerElm.click();
dropdown.$nextTick(_ => { setTimeout(_ => {
expect(dropdown.visible).to.be.true; expect(dropdown.visible).to.be.true;
done(); done();
}); }, 300);
}); });
}); });
it('split button', done => { it('split button', done => {