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
Léo-Paul Géneau
gitlab-ce
Commits
d9a3bbce
Commit
d9a3bbce
authored
Sep 21, 2017
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IssueNotes: Resize comment form after note submit and discard.
parent
d15109dc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
app/assets/javascripts/notes/components/issue_comment_form.vue
...ssets/javascripts/notes/components/issue_comment_form.vue
+8
-0
spec/javascripts/notes/components/issue_comment_form_spec.js
spec/javascripts/notes/components/issue_comment_form_spec.js
+14
-0
No files found.
app/assets/javascripts/notes/components/issue_comment_form.vue
View file @
d9a3bbce
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
/* global Flash, Autosave */
/* global Flash, Autosave */
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
{
mapActions
,
mapGetters
}
from
'
vuex
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
autosize
from
'
vendor/autosize
'
;
import
'
../../autosave
'
;
import
'
../../autosave
'
;
import
TaskList
from
'
../../task_list
'
;
import
TaskList
from
'
../../task_list
'
;
import
*
as
constants
from
'
../constants
'
;
import
*
as
constants
from
'
../constants
'
;
...
@@ -124,6 +125,7 @@
...
@@ -124,6 +125,7 @@
}
}
this
.
isSubmitting
=
true
;
this
.
isSubmitting
=
true
;
this
.
note
=
''
;
// Empty textarea while being requested. Repopulate in catch
this
.
note
=
''
;
// Empty textarea while being requested. Repopulate in catch
this
.
resizeTextarea
();
this
.
saveNote
(
noteData
)
this
.
saveNote
(
noteData
)
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
...
@@ -174,6 +176,7 @@
...
@@ -174,6 +176,7 @@
if
(
shouldClear
)
{
if
(
shouldClear
)
{
this
.
note
=
''
;
this
.
note
=
''
;
this
.
resizeTextarea
();
}
}
// reset autostave
// reset autostave
...
@@ -205,6 +208,11 @@
...
@@ -205,6 +208,11 @@
selector
:
'
.notes
'
,
selector
:
'
.notes
'
,
});
});
},
},
resizeTextarea
()
{
this
.
$nextTick
(()
=>
{
autosize
.
update
(
this
.
$refs
.
textarea
);
});
},
},
},
mounted
()
{
mounted
()
{
// jQuery is needed here because it is a custom event being dispatched with jQuery.
// jQuery is needed here because it is a custom event being dispatched with jQuery.
...
...
spec/javascripts/notes/components/issue_comment_form_spec.js
View file @
d9a3bbce
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
autosize
from
'
vendor/autosize
'
;
import
store
from
'
~/notes/stores
'
;
import
store
from
'
~/notes/stores
'
;
import
issueCommentForm
from
'
~/notes/components/issue_comment_form.vue
'
;
import
issueCommentForm
from
'
~/notes/components/issue_comment_form.vue
'
;
import
{
loggedOutIssueData
,
notesDataMock
,
userDataMock
,
issueDataMock
}
from
'
../mock_data
'
;
import
{
loggedOutIssueData
,
notesDataMock
,
userDataMock
,
issueDataMock
}
from
'
../mock_data
'
;
...
@@ -55,6 +56,19 @@ describe('issue_comment_form component', () => {
...
@@ -55,6 +56,19 @@ describe('issue_comment_form component', () => {
expect
(
vm
.
$el
.
querySelector
(
`a[href="
${
quickActionsDocsPath
}
"]`
).
textContent
.
trim
()).
toEqual
(
'
quick actions
'
);
expect
(
vm
.
$el
.
querySelector
(
`a[href="
${
quickActionsDocsPath
}
"]`
).
textContent
.
trim
()).
toEqual
(
'
quick actions
'
);
});
});
it
(
'
should resize textarea after note discarded
'
,
(
done
)
=>
{
spyOn
(
autosize
,
'
update
'
);
spyOn
(
vm
,
'
discard
'
).
and
.
callThrough
();
vm
.
note
=
'
foo
'
;
vm
.
discard
();
Vue
.
nextTick
(()
=>
{
expect
(
autosize
.
update
).
toHaveBeenCalled
();
done
();
});
});
describe
(
'
edit mode
'
,
()
=>
{
describe
(
'
edit mode
'
,
()
=>
{
it
(
'
should enter edit mode when arrow up is pressed
'
,
()
=>
{
it
(
'
should enter edit mode when arrow up is pressed
'
,
()
=>
{
spyOn
(
vm
,
'
editCurrentUserLastNote
'
).
and
.
callThrough
();
spyOn
(
vm
,
'
editCurrentUserLastNote
'
).
and
.
callThrough
();
...
...
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