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
Show 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';
...
@@ -3,7 +3,7 @@ import Vuex from 'vuex';
import
DiffLineNoteForm
from
'
~/diffs/components/diff_line_note_form.vue
'
;
import
DiffLineNoteForm
from
'
~/diffs/components/diff_line_note_form.vue
'
;
import
NoteForm
from
'
~/notes/components/note_form.vue
'
;
import
NoteForm
from
'
~/notes/components/note_form.vue
'
;
import
diffFileMockData
from
'
jest/diffs/mock_data/diff_file
'
;
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
();
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
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';
...
@@ -2,7 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
import
{
TEST_HOST
}
from
'
spec/test_constants
'
;
import
createStore
from
'
~/notes/stores
'
;
import
createStore
from
'
~/notes/stores
'
;
import
noteActions
from
'
~/notes/components/note_actions.vue
'
;
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
'
,
()
=>
{
describe
(
'
noteActions
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
...
@@ -48,7 +48,7 @@ describe('noteActions', () => {
...
@@ -48,7 +48,7 @@ describe('noteActions', () => {
const
resolveButton
=
wrapper
.
find
({
ref
:
'
resolveButton
'
});
const
resolveButton
=
wrapper
.
find
({
ref
:
'
resolveButton
'
});
expect
(
resolveButton
.
exists
()).
toBe
(
true
);
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
Vue
from
'
vue
'
;
import
{
createStore
}
from
'
ee/batch_comments/stores
'
;
import
{
createStore
}
from
'
ee/batch_comments/stores
'
;
import
{
keyboardDownEvent
}
from
'
spec
/issue_show/helpers
'
;
import
{
keyboardDownEvent
}
from
'
jest
/issue_show/helpers
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
spec
/notes/mock_data
'
;
import
{
noteableDataMock
,
discussionMock
,
notesDataMock
}
from
'
jest
/notes/mock_data
'
;
import
diffsModule
from
'
~/diffs/store/modules
'
;
import
diffsModule
from
'
~/diffs/store/modules
'
;
import
notesModule
from
'
~/notes/stores/modules
'
;
import
notesModule
from
'
~/notes/stores/modules
'
;
import
issueNoteForm
from
'
~/notes/components/note_form.vue
'
;
import
issueNoteForm
from
'
~/notes/components/note_form.vue
'
;
...
@@ -45,7 +45,7 @@ describe('issue_note_form component', () => {
...
@@ -45,7 +45,7 @@ describe('issue_note_form component', () => {
describe
(
'
on enter
'
,
()
=>
{
describe
(
'
on enter
'
,
()
=>
{
it
(
'
should add comment when cmd+enter is pressed
'
,
()
=>
{
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
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
...
@@ -53,7 +53,7 @@ describe('issue_note_form component', () => {
...
@@ -53,7 +53,7 @@ describe('issue_note_form component', () => {
});
});
it
(
'
should add comment when ctrl+enter is pressed
'
,
()
=>
{
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
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
...
@@ -63,12 +63,8 @@ describe('issue_note_form component', () => {
...
@@ -63,12 +63,8 @@ describe('issue_note_form component', () => {
});
});
describe
(
'
with batch comments
'
,
()
=>
{
describe
(
'
with batch comments
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(()
=>
{
store
return
store
.
dispatch
(
'
batchComments/enableBatchComments
'
).
then
(
vm
.
$nextTick
);
.
dispatch
(
'
batchComments/enableBatchComments
'
)
.
then
(
vm
.
$nextTick
)
.
then
(
done
)
.
catch
(
done
.
fail
);
});
});
it
(
'
shows resolve checkbox
'
,
()
=>
{
it
(
'
shows resolve checkbox
'
,
()
=>
{
...
@@ -77,21 +73,19 @@ describe('issue_note_form component', () => {
...
@@ -77,21 +73,19 @@ describe('issue_note_form component', () => {
).
not
.
toBe
(
null
);
).
not
.
toBe
(
null
);
});
});
it
(
'
hides actions for commits
'
,
done
=>
{
it
(
'
hides actions for commits
'
,
()
=>
{
vm
.
discussion
.
for_commit
=
true
;
vm
.
discussion
.
for_commit
=
true
;
vm
.
$nextTick
(()
=>
{
return
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.note-form-actions
'
).
textContent
).
not
.
toContain
(
expect
(
vm
.
$el
.
querySelector
(
'
.note-form-actions
'
).
textContent
).
not
.
toContain
(
'
Start a review
'
,
'
Start a review
'
,
);
);
done
();
});
});
});
});
describe
(
'
on enter
'
,
()
=>
{
describe
(
'
on enter
'
,
()
=>
{
it
(
'
should start review or add to review when cmd+enter is pressed
'
,
()
=>
{
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
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
true
));
...
@@ -99,7 +93,7 @@ describe('issue_note_form component', () => {
...
@@ -99,7 +93,7 @@ describe('issue_note_form component', () => {
});
});
it
(
'
should start review or add to review when ctrl+enter is pressed
'
,
()
=>
{
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
'
).
value
=
'
Foo
'
;
vm
.
$el
.
querySelector
(
'
textarea
'
).
dispatchEvent
(
keyboardDownEvent
(
13
,
false
,
true
));
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