Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Element
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林焕东
Element
Commits
fb99bc90
Commit
fb99bc90
authored
Jun 09, 2017
by
Hugo
Committed by
杨奕
Jul 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dropdown: Allow any type from items' `command` prop
parent
b74ccda1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
packages/dropdown/src/dropdown-item.vue
packages/dropdown/src/dropdown-item.vue
+1
-1
test/unit/specs/dropdown.spec.js
test/unit/specs/dropdown.spec.js
+9
-3
No files found.
packages/dropdown/src/dropdown-item.vue
View file @
fb99bc90
...
...
@@ -19,7 +19,7 @@
mixins
:
[
Emitter
],
props
:
{
command
:
String
,
command
:
null
,
disabled
:
Boolean
,
divided
:
Boolean
},
...
...
test/unit/specs/dropdown.spec.js
View file @
fb99bc90
...
...
@@ -40,6 +40,7 @@ describe('Dropdown', () => {
},
400
);
});
it
(
'
menu click
'
,
done
=>
{
const
myCommandObject
=
{
name
:
'
CommandC
'
};
vm
=
createVue
({
template
:
`
<el-dropdown ref="dropdown">
...
...
@@ -49,12 +50,17 @@ describe('Dropdown', () => {
<el-dropdown-menu slot="dropdown">
<el-dropdown-item command="a">黄金糕</el-dropdown-item>
<el-dropdown-item command="b">狮子头</el-dropdown-item>
<el-dropdown-item ref="commandC"
command="c
">螺蛳粉</el-dropdown-item>
<el-dropdown-item ref="commandC"
:command="myCommandObject
">螺蛳粉</el-dropdown-item>
<el-dropdown-item command="d">双皮奶</el-dropdown-item>
<el-dropdown-item command="e">蚵仔煎</el-dropdown-item>
</el-dropdown-menu>
</el-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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment