Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ant-design-pro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thiago Borges
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
CheckPermissions.js
src/components/Authorized/CheckPermissions.js
+4
-4
home.e2e.js
src/e2e/home.e2e.js
+9
-0
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) => {
return
target
;
}
// 数组处理
if
(
authority
.
constructor
.
name
===
'Array'
)
{
if
(
authority
.
in
cludes
(
currentAuthority
)
)
{
if
(
Array
.
isArray
(
authority
)
)
{
if
(
authority
.
in
dexOf
(
currentAuthority
)
>=
0
)
{
return
target
;
}
return
Exception
;
}
// string 处理
if
(
authority
.
constructor
.
name
===
'S
tring'
)
{
if
(
typeof
authority
===
's
tring'
)
{
if
(
authority
===
currentAuthority
)
{
return
target
;
}
...
...
@@ -39,7 +39,7 @@ const checkPermissions = (authority, currentAuthority, target, Exception) => {
}
// Function 处理
if
(
authority
.
constructor
.
name
===
'F
unction'
)
{
if
(
typeof
authority
===
'f
unction'
)
{
try
{
const
bool
=
authority
();
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', () => {
let
page
;
beforeEach
(()
=>
{
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
()
=>
{
...
...
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