From fb99bc90b12007ac8350723e7a67fe42c156d6f6 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 9 Jun 2017 11:30:02 -0400 Subject: [PATCH] Dropdown: Allow any type from items' `command` prop --- packages/dropdown/src/dropdown-item.vue | 2 +- test/unit/specs/dropdown.spec.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/dropdown/src/dropdown-item.vue b/packages/dropdown/src/dropdown-item.vue index c7d1990b..0580b057 100644 --- a/packages/dropdown/src/dropdown-item.vue +++ b/packages/dropdown/src/dropdown-item.vue @@ -19,7 +19,7 @@ mixins: [Emitter], props: { - command: String, + command: null, disabled: Boolean, divided: Boolean }, diff --git a/test/unit/specs/dropdown.spec.js b/test/unit/specs/dropdown.spec.js index 03f79f19..da3141a3 100644 --- a/test/unit/specs/dropdown.spec.js +++ b/test/unit/specs/dropdown.spec.js @@ -40,6 +40,7 @@ describe('Dropdown', () => { }, 400); }); it('menu click', done => { + const myCommandObject = { name: 'CommandC' }; vm = createVue({ template: ` @@ -49,12 +50,17 @@ describe('Dropdown', () => { 黄金糕 狮子头 - 螺蛳粉 + 螺蛳粉 双皮奶 蚵仔煎 - ` + `, + data() { + return { + myCommandObject + }; + } }, true); let dropdown = vm.$refs.dropdown; let dropdownElm = dropdown.$el; @@ -68,7 +74,7 @@ describe('Dropdown', () => { vm.$refs.commandC.$el.click(); setTimeout(_ => { expect(dropdown.visible).to.not.true; - expect(callback.calledWith('c')).to.be.true; + expect(callback.calledWith(myCommandObject)).to.be.true; destroyVM(vm); done(); }, 300);