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
c12ad016
Commit
c12ad016
authored
Jul 13, 2018
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing specs :fingers-crossed:
parent
9cd5ca2f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
14 deletions
+46
-14
app/assets/javascripts/diffs/components/diff_line_note_form.vue
...sets/javascripts/diffs/components/diff_line_note_form.vue
+6
-4
spec/javascripts/diffs/components/diff_line_note_form_spec.js
.../javascripts/diffs/components/diff_line_note_form_spec.js
+33
-8
spec/javascripts/notes/components/noteable_discussion_spec.js
.../javascripts/notes/components/noteable_discussion_spec.js
+7
-2
No files found.
app/assets/javascripts/diffs/components/diff_line_note_form.vue
View file @
c12ad016
...
...
@@ -54,11 +54,13 @@ export default {
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
cancelCommentForm
'
]),
...
mapActions
([
'
saveNote
'
,
'
refetchDiscussionById
'
]),
handleCancelCommentForm
()
{
handleCancelCommentForm
(
shouldConfirm
,
isDirty
)
{
if
(
shouldConfirm
&&
isDirty
)
{
// eslint-disable-next-line no-alert
if
(
!
window
.
confirm
(
'
Are you sure you want to cancel creating this comment?
'
))
{
return
;
}
}
this
.
cancelCommentForm
({
lineCode
:
this
.
line
.
lineCode
,
...
...
spec/javascripts/diffs/components/diff_line_note_form_spec.js
View file @
c12ad016
...
...
@@ -3,6 +3,7 @@ import DiffLineNoteForm from '~/diffs/components/diff_line_note_form.vue';
import
store
from
'
~/mr_notes/stores
'
;
import
{
createComponentWithStore
}
from
'
spec/helpers/vue_mount_component_helper
'
;
import
diffFileMockData
from
'
../mock_data/diff_file
'
;
import
{
noteableDataMock
}
from
'
../../notes/mock_data
'
;
describe
(
'
DiffLineNoteForm
'
,
()
=>
{
let
component
;
...
...
@@ -21,10 +22,9 @@ describe('DiffLineNoteForm', () => {
noteTargetLine
:
diffLines
[
0
],
});
Object
.
defineProperty
(
component
,
'
isLoggedIn
'
,
{
get
()
{
return
true
;
},
Object
.
defineProperties
(
component
,
{
noteableData
:
{
value
:
noteableDataMock
},
isLoggedIn
:
{
value
:
true
},
});
component
.
$mount
();
...
...
@@ -32,13 +32,38 @@ describe('DiffLineNoteForm', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
handleCancelCommentForm
'
,
()
=>
{
it
(
'
should call cancelCommentForm with lineCode
'
,
()
=>
{
it
(
'
should ask for confirmation when shouldConfirm and isDirty passed as truthy
'
,
()
=>
{
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
false
);
component
.
handleCancelCommentForm
(
true
,
true
);
expect
(
window
.
confirm
).
toHaveBeenCalled
();
});
it
(
'
should ask for confirmation when one of the params false
'
,
()
=>
{
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
false
);
component
.
handleCancelCommentForm
(
true
,
false
);
expect
(
window
.
confirm
).
not
.
toHaveBeenCalled
();
component
.
handleCancelCommentForm
(
false
,
true
);
expect
(
window
.
confirm
).
not
.
toHaveBeenCalled
();
});
it
(
'
should call cancelCommentForm with lineCode
'
,
done
=>
{
spyOn
(
window
,
'
confirm
'
);
spyOn
(
component
,
'
cancelCommentForm
'
);
spyOn
(
component
,
'
resetAutoSave
'
);
component
.
handleCancelCommentForm
();
expect
(
window
.
confirm
).
not
.
toHaveBeenCalled
();
component
.
$nextTick
(()
=>
{
expect
(
component
.
cancelCommentForm
).
toHaveBeenCalledWith
({
lineCode
:
diffLines
[
0
].
lineCode
,
});
expect
(
component
.
resetAutoSave
).
toHaveBeenCalled
();
done
();
});
});
});
...
...
@@ -66,7 +91,7 @@ describe('DiffLineNoteForm', () => {
describe
(
'
mounted
'
,
()
=>
{
it
(
'
should init autosave
'
,
()
=>
{
const
key
=
'
autosave/Note/
issue/
//DiffNote//1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_1
'
;
const
key
=
'
autosave/Note/
Issue/98
//DiffNote//1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_1_1
'
;
expect
(
component
.
autosave
).
toBeDefined
();
expect
(
component
.
autosave
.
key
).
toEqual
(
key
);
...
...
spec/javascripts/notes/components/noteable_discussion_spec.js
View file @
c12ad016
...
...
@@ -46,12 +46,17 @@ describe('noteable_discussion component', () => {
it
(
'
should toggle reply form
'
,
done
=>
{
vm
.
$el
.
querySelector
(
'
.js-vue-discussion-reply
'
).
click
();
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$refs
.
noteForm
).
not
.
toBeNull
();
expect
(
vm
.
isReplying
).
toEqual
(
true
);
// There is a watcher for `isReplying` which will init autosave in the next tick
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$refs
.
noteForm
).
not
.
toBeNull
();
done
();
});
});
});
it
(
'
does not render jump to discussion button
'
,
()
=>
{
expect
(
...
...
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