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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a4041b1e
Commit
a4041b1e
authored
Dec 25, 2019
by
Illya Klymov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use proper find targets in test
parent
13adffbc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
spec/frontend/notes/components/discussion_notes_spec.js
spec/frontend/notes/components/discussion_notes_spec.js
+12
-6
No files found.
spec/frontend/notes/components/discussion_notes_spec.js
View file @
a4041b1e
...
...
@@ -6,7 +6,6 @@ import NoteableNote from '~/notes/components/noteable_note.vue';
import
PlaceholderNote
from
'
~/vue_shared/components/notes/placeholder_note.vue
'
;
import
PlaceholderSystemNote
from
'
~/vue_shared/components/notes/placeholder_system_note.vue
'
;
import
SystemNote
from
'
~/vue_shared/components/notes/system_note.vue
'
;
import
TimelineEntryItem
from
'
~/vue_shared/components/notes/timeline_entry_item.vue
'
;
import
createStore
from
'
~/notes/stores
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
../../notes/mock_data
'
;
...
...
@@ -48,13 +47,13 @@ describe('DiscussionNotes', () => {
it
(
'
renders an element for each note in the discussion
'
,
()
=>
{
createComponent
();
const
notesCount
=
discussionMock
.
notes
.
length
;
const
els
=
wrapper
.
findAll
(
TimelineEntryItem
);
const
els
=
wrapper
.
findAll
(
NoteableNote
);
expect
(
els
.
length
).
toBe
(
notesCount
);
});
it
(
'
renders one element if replies groupping is enabled
'
,
()
=>
{
createComponent
({
shouldGroupReplies
:
true
});
const
els
=
wrapper
.
findAll
(
TimelineEntryItem
);
const
els
=
wrapper
.
findAll
(
NoteableNote
);
expect
(
els
.
length
).
toBe
(
1
);
});
...
...
@@ -85,7 +84,7 @@ describe('DiscussionNotes', () => {
];
discussion
.
notes
=
notesData
;
createComponent
({
discussion
,
shouldRenderDiffs
:
true
});
const
notes
=
wrapper
.
findAll
(
'
.notes >
li
'
);
const
notes
=
wrapper
.
findAll
(
'
.notes >
*
'
);
expect
(
notes
.
at
(
0
).
is
(
PlaceholderSystemNote
)).
toBe
(
true
);
expect
(
notes
.
at
(
1
).
is
(
PlaceholderNote
)).
toBe
(
true
);
...
...
@@ -111,7 +110,14 @@ describe('DiscussionNotes', () => {
describe
(
'
events
'
,
()
=>
{
describe
(
'
with groupped notes and replies expanded
'
,
()
=>
{
const
findNoteAtIndex
=
index
=>
wrapper
.
find
(
`.note:nth-of-type(
${
index
+
1
}
`
);
const
findNoteAtIndex
=
index
=>
{
const
noteComponents
=
[
NoteableNote
,
SystemNote
,
PlaceholderNote
,
PlaceholderSystemNote
];
const
allowedNames
=
noteComponents
.
map
(
c
=>
c
.
name
);
return
wrapper
.
findAll
(
'
.notes *
'
)
.
filter
(
w
=>
allowedNames
.
includes
(
w
.
name
()))
.
at
(
index
);
};
beforeEach
(()
=>
{
createComponent
({
shouldGroupReplies
:
true
,
isExpanded
:
true
});
...
...
@@ -137,7 +143,7 @@ describe('DiscussionNotes', () => {
let
note
;
beforeEach
(()
=>
{
createComponent
();
note
=
wrapper
.
find
(
'
.note
'
);
note
=
wrapper
.
find
(
'
.note
s > *
'
);
});
it
(
'
emits deleteNote when first note emits handleDeleteNote
'
,
()
=>
{
...
...
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