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
23eafed2
Commit
23eafed2
authored
Mar 16, 2020
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate ee/notes to Jest
Closes
https://gitlab.com/gitlab-org/gitlab/-/issues/194297
parent
7f4cd47e
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
1283 deletions
+13
-1283
ee/spec/frontend/diffs/components/diff_line_note_form_spec.js
...pec/frontend/diffs/components/diff_line_note_form_spec.js
+1
-1
ee/spec/frontend/notes/components/note_actions_spec.js
ee/spec/frontend/notes/components/note_actions_spec.js
+2
-2
ee/spec/frontend/notes/components/note_form_spec.js
ee/spec/frontend/notes/components/note_form_spec.js
+10
-16
ee/spec/frontend/notes/mock_data.js
ee/spec/frontend/notes/mock_data.js
+0
-1264
No files found.
ee/spec/frontend/diffs/components/diff_line_note_form_spec.js
View file @
23eafed2
...
...
@@ -3,7 +3,7 @@ import Vuex from 'vuex';
import
DiffLineNoteForm
from
'
~/diffs/components/diff_line_note_form.vue
'
;
import
NoteForm
from
'
~/notes/components/note_form.vue
'
;
import
diffFileMockData
from
'
jest/diffs/mock_data/diff_file
'
;
import
note
from
'
../..
/notes/mock_data
'
;
import
note
from
'
jest
/notes/mock_data
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
...
...
ee/spec/frontend/notes/components/note_actions_spec.js
View file @
23eafed2
...
...
@@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
import
createStore
from
'
~/notes/stores
'
;
import
noteActions
from
'
~/notes/components/note_actions.vue
'
;
import
{
userDataMock
}
from
'
../../../../spec/frontend
/notes/mock_data
'
;
import
{
userDataMock
}
from
'
jest
/notes/mock_data
'
;
describe
(
'
noteActions
'
,
()
=>
{
let
wrapper
;
...
...
@@ -48,7 +48,7 @@ describe('noteActions', () => {
const
resolveButton
=
wrapper
.
find
({
ref
:
'
resolveButton
'
});
expect
(
resolveButton
.
exists
()).
toBe
(
true
);
expect
(
resolveButton
.
attributes
(
'
title
'
)).
to
Equal
(
'
Thread stays unresolved
'
);
expect
(
resolveButton
.
attributes
(
'
title
'
)).
to
Be
(
'
Thread stays unresolved
'
);
});
});
});
ee/spec/
javascripts
/notes/components/note_form_spec.js
→
ee/spec/
frontend
/notes/components/note_form_spec.js
View file @
23eafed2
import
Vue
from
'
vue
'
;
import
{
createStore
}
from
'
ee/batch_comments/stores
'
;
import
{
keyboardDownEvent
}
from
'
spec
/issue_show/helpers
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
spec
/notes/mock_data
'
;
import
{
keyboardDownEvent
}
from
'
jest
/issue_show/helpers
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
jest
/notes/mock_data
'
;
import
diffsModule
from
'
~/diffs/store/modules
'
;
import
notesModule
from
'
~/notes/stores/modules
'
;
import
issueNoteForm
from
'
~/notes/components/note_form.vue
'
;
...
...
@@ -45,7 +45,7 @@ describe('issue_note_form component', () => {
describe
(
'
on enter
'
,
()
=>
{
it
(
'
should add comment when cmd+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleUpdate
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
,
'
handleUpdate
'
);
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
...
...
@@ -53,7 +53,7 @@ describe('issue_note_form component', () => {
});
it
(
'
should add comment when ctrl+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleUpdate
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
,
'
handleUpdate
'
);
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
...
...
@@ -63,12 +63,8 @@ describe('issue_note_form component', () => {
});
describe
(
'
with batch comments
'
,
()
=>
{
beforeEach
(
done
=>
{
store
.
dispatch
(
'
batchComments/enableBatchComments
'
)
.
then
(
vm
.
$nextTick
)
.
then
(
done
)
.
catch
(
done
.
fail
);
beforeEach
(()
=>
{
return
store
.
dispatch
(
'
batchComments/enableBatchComments
'
).
then
(
vm
.
$nextTick
);
});
it
(
'
shows resolve checkbox
'
,
()
=>
{
...
...
@@ -77,21 +73,19 @@ describe('issue_note_form component', () => {
).
not
.
toBe
(
null
);
});
it
(
'
hides actions for commits
'
,
done
=>
{
it
(
'
hides actions for commits
'
,
()
=>
{
vm
.
discussion
.
for_commit
=
true
;
vm
.
$nextTick
(()
=>
{
return
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.note-form-actions
'
).
textContent
).
not
.
toContain
(
'
Start a review
'
,
);
done
();
});
});
describe
(
'
on enter
'
,
()
=>
{
it
(
'
should start review or add to review when cmd+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleAddToReview
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
,
'
handleAddToReview
'
);
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
...
...
@@ -99,7 +93,7 @@ describe('issue_note_form component', () => {
});
it
(
'
should start review or add to review when ctrl+enter is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
handleAddToReview
'
).
and
.
callThrough
(
);
jest
.
spyOn
(
vm
,
'
handleAddToReview
'
);
vm
.
$el
.
querySelector
(
'
textarea
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
...
...
ee/spec/frontend/notes/mock_data.js
deleted
100644 → 0
View file @
7f4cd47e
This diff is collapsed.
Click to expand it.
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