Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
3e92f44f
Commit
3e92f44f
authored
Aug 11, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds unit tests to issue_note_actions component
parent
e81dd242
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
7 deletions
+63
-7
spec/javascripts/notes/components/issue_note_actions_spec.js
spec/javascripts/notes/components/issue_note_actions_spec.js
+63
-7
No files found.
spec/javascripts/notes/components/issue_note_actions_spec.js
View file @
3e92f44f
import
Vue
from
'
vue
'
;
import
store
from
'
~/notes/stores
'
;
import
issueActions
from
'
~/notes/components/issue_note_actions.vue
'
;
import
{
userDataMock
}
from
'
../mock_data
'
;
describe
(
'
issse_note_actions component
'
,
()
=>
{
it
(
'
should render access level badge
'
,
()
=>
{
let
vm
;
let
Component
;
beforeEach
(()
=>
{
Component
=
Vue
.
extend
(
issueActions
);
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
user is logged in
'
,
()
=>
{
it
(
'
should render emoji link
'
,
()
=>
{
let
props
;
beforeEach
(()
=>
{
props
=
{
accessLevel
:
'
Master
'
,
authorId
:
26
,
canDelete
:
true
,
canEdit
:
true
,
canReportAsAbuse
:
true
,
noteId
:
539
,
reportAbusePath
:
'
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_539&user_id=26
'
,
};
store
.
dispatch
(
'
setUserData
'
,
userDataMock
);
vm
=
new
Component
({
store
,
propsData
:
props
,
}).
$mount
();
});
it
(
'
should render access level badge
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.note-role
'
).
textContent
.
trim
()).
toEqual
(
props
.
accessLevel
);
});
it
(
'
should render emoji link
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-add-award
'
)).
toBeDefined
();
});
describe
(
'
actions dropdown
'
,
()
=>
{
it
(
'
should be possible to edit the comment
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-note-edit
'
)).
toBeDefined
();
});
it
(
'
should be possible to report as abuse
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
`a[href="
${
props
.
reportAbusePath
}
"]`
)).
toBeDefined
();
});
it
(
'
should be possible to delete comment
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-note-delete
'
)).
toBeDefined
();
});
});
});
describe
(
'
user is not logged in
'
,
()
=>
{
it
(
'
should not render emoji link
'
,
()
=>
{
let
props
;
beforeEach
(()
=>
{
store
.
dispatch
(
'
setUserData
'
,
{});
props
=
{
accessLevel
:
'
Master
'
,
authorId
:
26
,
canDelete
:
false
,
canEdit
:
false
,
canReportAsAbuse
:
false
,
noteId
:
539
,
reportAbusePath
:
'
/abuse_reports/new?ref_url=http%3A%2F%2Flocalhost%3A3000%2Fgitlab-org%2Fgitlab-ce%2Fissues%2F7%23note_539&user_id=26
'
,
};
vm
=
new
Component
({
store
,
propsData
:
props
,
}).
$mount
();
});
it
(
'
should not render actions dropdown
'
,
()
=>
{
it
(
'
should not render emoji link
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-add-award
'
)).
toEqual
(
null
);
});
it
(
'
should not render actions dropdown
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.more-actions
'
)).
toEqual
(
null
);
});
});
});
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