Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
e4c43737
Commit
e4c43737
authored
7 years ago
by
Alan Wei
Committed by
ιεΈ
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix functionName typo from getMeunMatcheys to getMeunMatchKeys
parent
29e9547d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
src/components/SiderMenu/SiderMenu.js
src/components/SiderMenu/SiderMenu.js
+3
-3
src/components/SiderMenu/SilderMenu.test.js
src/components/SiderMenu/SilderMenu.test.js
+6
-6
No files found.
src/components/SiderMenu/SiderMenu.js
View file @
e4c43737
...
...
@@ -22,7 +22,7 @@ const getIcon = icon => {
return
icon
;
};
export
const
getMeunMatcheys
=
(
flatMenuKeys
,
path
)
=>
{
export
const
getMeunMatch
K
eys
=
(
flatMenuKeys
,
path
)
=>
{
return
flatMenuKeys
.
filter
(
item
=>
{
return
pathToRegexp
(
item
).
test
(
path
);
});
...
...
@@ -53,7 +53,7 @@ export default class SiderMenu extends PureComponent {
const
{
location
:
{
pathname
}
}
=
props
||
this
.
props
;
return
urlToList
(
pathname
)
.
map
(
item
=>
{
return
getMeunMatcheys
(
this
.
flatMenuKeys
,
item
)[
0
];
return
getMeunMatch
K
eys
(
this
.
flatMenuKeys
,
item
)[
0
];
})
.
filter
(
item
=>
item
);
}
...
...
@@ -159,7 +159,7 @@ export default class SiderMenu extends PureComponent {
// Get the currently selected menu
getSelectedMenuKeys
=
()
=>
{
const
{
location
:
{
pathname
}
}
=
this
.
props
;
return
urlToList
(
pathname
).
map
(
itemPath
=>
getMeunMatcheys
(
this
.
flatMenuKeys
,
itemPath
).
pop
());
return
urlToList
(
pathname
).
map
(
itemPath
=>
getMeunMatch
K
eys
(
this
.
flatMenuKeys
,
itemPath
).
pop
());
};
// conversion Path
// 转εθ·―εΎ
...
...
This diff is collapsed.
Click to expand it.
src/components/SiderMenu/SilderMenu.test.js
View file @
e4c43737
import
{
getMeunMatcheys
}
from
'
./SiderMenu
'
;
import
{
getMeunMatch
K
eys
}
from
'
./SiderMenu
'
;
const
meun
=
[
'
/dashboard
'
,
'
/userinfo
'
,
'
/dashboard/name
'
,
'
/userinfo/:id
'
,
'
/userinfo/:id/info
'
];
describe
(
'
test meun match
'
,
()
=>
{
it
(
'
simple path
'
,
()
=>
{
expect
(
getMeunMatcheys
(
meun
,
'
/dashboard
'
)).
toEqual
([
'
/dashboard
'
]);
expect
(
getMeunMatch
K
eys
(
meun
,
'
/dashboard
'
)).
toEqual
([
'
/dashboard
'
]);
});
it
(
'
error path
'
,
()
=>
{
expect
(
getMeunMatcheys
(
meun
,
'
/dashboardname
'
)).
toEqual
([]);
expect
(
getMeunMatch
K
eys
(
meun
,
'
/dashboardname
'
)).
toEqual
([]);
});
it
(
'
Secondary path
'
,
()
=>
{
expect
(
getMeunMatcheys
(
meun
,
'
/dashboard/name
'
)).
toEqual
([
'
/dashboard/name
'
]);
expect
(
getMeunMatch
K
eys
(
meun
,
'
/dashboard/name
'
)).
toEqual
([
'
/dashboard/name
'
]);
});
it
(
'
Parameter path
'
,
()
=>
{
expect
(
getMeunMatcheys
(
meun
,
'
/userinfo/2144
'
)).
toEqual
([
'
/userinfo/:id
'
]);
expect
(
getMeunMatch
K
eys
(
meun
,
'
/userinfo/2144
'
)).
toEqual
([
'
/userinfo/:id
'
]);
});
it
(
'
three parameter path
'
,
()
=>
{
expect
(
getMeunMatcheys
(
meun
,
'
/userinfo/2144/info
'
)).
toEqual
([
'
/userinfo/:id/info
'
]);
expect
(
getMeunMatch
K
eys
(
meun
,
'
/userinfo/2144/info
'
)).
toEqual
([
'
/userinfo/:id/info
'
]);
});
});
This diff is collapsed.
Click to expand it.
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