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
Jérome Perrin
gitlab-ce
Commits
d37881b7
Commit
d37881b7
authored
Aug 09, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ci skip] Adds unit tests for issue_note_header component
parent
c15174c0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
4 deletions
+88
-4
app/assets/javascripts/notes/components/issue_note_header.vue
...assets/javascripts/notes/components/issue_note_header.vue
+2
-1
spec/javascripts/notes/components/issue_note_header_spec.js
spec/javascripts/notes/components/issue_note_header_spec.js
+82
-3
spec/javascripts/notes/components/issue_placeholder_note_spec.js
...vascripts/notes/components/issue_placeholder_note_spec.js
+4
-0
No files found.
app/assets/javascripts/notes/components/issue_note_header.vue
View file @
d37881b7
...
...
@@ -34,6 +34,7 @@
toggleHandler
:
{
type
:
Function
,
required
:
false
,
default
:
()
=>
{},
},
},
data
()
{
...
...
@@ -102,7 +103,7 @@
class=
"discussion-actions"
>
<button
@
click=
"handleToggle"
class=
"note-action-button discussion-toggle-button js-toggle-button"
class=
"note-action-button discussion-toggle-button js-
vue-
toggle-button"
type=
"button"
>
<i
:class=
"toggleChevronClass"
...
...
spec/javascripts/notes/components/issue_note_header_spec.js
View file @
d37881b7
import
Vue
from
'
vue
'
;
import
issueNoteHeader
from
'
~/notes/components/issue_note_header.vue
'
;
import
store
from
'
~/notes/stores
'
;
describe
(
'
issue_note_header component
'
,
()
=>
{
it
(
'
should render user information
'
,
()
=>
{
let
vm
;
let
Component
;
beforeEach
(()
=>
{
Component
=
Vue
.
extend
(
issueNoteHeader
);
});
it
(
'
should render timestamp link
'
,
()
=>
{
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
individual note
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
new
Component
({
store
,
propsData
:
{
actionText
:
'
commented
'
,
actionTextHtml
:
''
,
author
:
{
avatar_url
:
null
,
id
:
1
,
name
:
'
Root
'
,
path
:
'
/root
'
,
state
:
'
active
'
,
username
:
'
root
'
,
},
createdAt
:
'
2017-08-02T10:51:58.559Z
'
,
includeToggle
:
false
,
noteId
:
1394
,
},
}).
$mount
();
});
it
(
'
should render user information
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.note-header-author-name
'
).
textContent
.
trim
(),
).
toEqual
(
'
Root
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.note-header-info a
'
).
getAttribute
(
'
href
'
),
).
toEqual
(
'
/root
'
);
});
it
(
'
should render timestamp link
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
a[href="#note_1394"]
'
)).
toBeDefined
();
});
});
describe
(
'
discussion
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
new
Component
({
store
,
propsData
:
{
actionText
:
'
started a discussion
'
,
actionTextHtml
:
''
,
author
:
{
avatar_url
:
null
,
id
:
1
,
name
:
'
Root
'
,
path
:
'
/root
'
,
state
:
'
active
'
,
username
:
'
root
'
,
},
createdAt
:
'
2017-08-02T10:51:58.559Z
'
,
includeToggle
:
true
,
noteId
:
1395
,
},
}).
$mount
();
});
it
(
'
should render toggle button
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-vue-toggle-button
'
)).
toBeDefined
();
});
it
(
'
should toggle the disucssion icon
'
,
(
done
)
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-vue-toggle-button i
'
).
classList
.
contains
(
'
fa-chevron-up
'
),
).
toEqual
(
true
);
vm
.
$el
.
querySelector
(
'
.js-vue-toggle-button
'
).
click
();
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-vue-toggle-button i
'
).
classList
.
contains
(
'
fa-chevron-down
'
),
).
toEqual
(
true
);
done
();
});
});
});
});
spec/javascripts/notes/components/issue_placeholder_note_spec.js
View file @
d37881b7
...
...
@@ -15,6 +15,10 @@ describe('issue placeholder system note component', () => {
}).
$mount
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
user information
'
,
()
=>
{
it
(
'
should render user avatar with link
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.user-avatar-link
'
).
getAttribute
(
'
href
'
)).
toEqual
(
userDataMock
.
path
);
...
...
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