Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
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
9666d03b
Commit
9666d03b
authored
Jan 08, 2018
by
afc163
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix test case finnally
parent
5af4b82e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
src/components/Authorized/CheckPermissions.js
src/components/Authorized/CheckPermissions.js
+4
-4
src/e2e/home.e2e.js
src/e2e/home.e2e.js
+9
-0
src/e2e/login.e2e.js
src/e2e/login.e2e.js
+6
-1
No files found.
src/components/Authorized/CheckPermissions.js
View file @
9666d03b
...
@@ -16,15 +16,15 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
...
@@ -16,15 +16,15 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
return
target
;
return
target
;
}
}
// ζ°η»ε€η
// ζ°η»ε€η
if
(
authority
.
constructor
.
name
===
'
Array
'
)
{
if
(
Array
.
isArray
(
authority
)
)
{
if
(
authority
.
in
cludes
(
currentAuthority
)
)
{
if
(
authority
.
in
dexOf
(
currentAuthority
)
>=
0
)
{
return
target
;
return
target
;
}
}
return
Exception
;
return
Exception
;
}
}
// string ε€η
// string ε€η
if
(
authority
.
constructor
.
name
===
'
S
tring
'
)
{
if
(
typeof
authority
===
'
s
tring
'
)
{
if
(
authority
===
currentAuthority
)
{
if
(
authority
===
currentAuthority
)
{
return
target
;
return
target
;
}
}
...
@@ -39,7 +39,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
...
@@ -39,7 +39,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
}
}
// Function ε€η
// Function ε€η
if
(
authority
.
constructor
.
name
===
'
F
unction
'
)
{
if
(
typeof
authority
===
'
f
unction
'
)
{
try
{
try
{
const
bool
=
authority
();
const
bool
=
authority
();
if
(
bool
)
{
if
(
bool
)
{
...
...
src/e2e/home.e2e.js
0 β 100644
View file @
9666d03b
import
Nightmare
from
'
nightmare
'
;
describe
(
'
Homepage
'
,
()
=>
{
it
(
'
it should have logo text
'
,
async
()
=>
{
const
page
=
Nightmare
().
goto
(
'
http://localhost:8000
'
);
const
text
=
await
page
.
wait
(
'
h1
'
).
evaluate
(()
=>
document
.
body
.
innerHTML
).
end
();
expect
(
text
).
toContain
(
'
<h1>Ant Design Pro</h1>
'
);
});
});
src/e2e/login.e2e.js
View file @
9666d03b
...
@@ -4,7 +4,12 @@ describe('Login', () => {
...
@@ -4,7 +4,12 @@ describe('Login', () => {
let
page
;
let
page
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
page
=
Nightmare
();
page
=
Nightmare
();
page
.
goto
(
'
http://localhost:8000/#/user/login
'
);
page
.
goto
(
'
http://localhost:8000/
'
)
.
evaluate
(()
=>
{
window
.
localStorage
.
setItem
(
'
antd-pro-authority
'
,
'
guest
'
);
})
.
goto
(
'
http://localhost:8000/#/user/login
'
);
});
});
it
(
'
should login with failure
'
,
async
()
=>
{
it
(
'
should login with failure
'
,
async
()
=>
{
...
...
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