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
e7b0334c
Commit
e7b0334c
authored
Aug 31, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add textarea autoresize after comment
parent
1c4e8663
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
13 deletions
+73
-13
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/notes.js
app/assets/javascripts/notes.js
+6
-1
spec/javascripts/fixtures/comments.html.haml
spec/javascripts/fixtures/comments.html.haml
+21
-0
spec/javascripts/notes_spec.js
spec/javascripts/notes_spec.js
+45
-12
No files found.
CHANGELOG
View file @
e7b0334c
...
@@ -15,6 +15,7 @@ v 8.12.0 (unreleased)
...
@@ -15,6 +15,7 @@ v 8.12.0 (unreleased)
- Fix bug where pagination is still displayed despite all todos marked as done (ClemMakesApps)
- Fix bug where pagination is still displayed despite all todos marked as done (ClemMakesApps)
- Shorten task status phrase (ClemMakesApps)
- Shorten task status phrase (ClemMakesApps)
- Add hover color to emoji icon (ClemMakesApps)
- Add hover color to emoji icon (ClemMakesApps)
- Add textarea autoresize after comment (ClemMakesApps)
- Fix branches page dropdown sort alignment (ClemMakesApps)
- Fix branches page dropdown sort alignment (ClemMakesApps)
- Add white background for no readme container (ClemMakesApps)
- Add white background for no readme container (ClemMakesApps)
- API: Expose issue confidentiality flag. (Robert Schilling)
- API: Expose issue confidentiality flag. (Robert Schilling)
...
...
app/assets/javascripts/notes.js
View file @
e7b0334c
...
@@ -331,7 +331,12 @@
...
@@ -331,7 +331,12 @@
form
.
find
(
"
.js-md-write-button
"
).
click
();
form
.
find
(
"
.js-md-write-button
"
).
click
();
form
.
find
(
"
.js-note-text
"
).
val
(
""
).
trigger
(
"
input
"
);
form
.
find
(
"
.js-note-text
"
).
val
(
""
).
trigger
(
"
input
"
);
form
.
find
(
"
.js-note-text
"
).
data
(
"
autosave
"
).
reset
();
form
.
find
(
"
.js-note-text
"
).
data
(
"
autosave
"
).
reset
();
return
this
.
updateTargetButtons
(
e
);
var
event
=
document
.
createEvent
(
'
Event
'
);
event
.
initEvent
(
'
autosize:update
'
,
true
,
false
);
form
.
find
(
'
.js-autosize
'
)[
0
].
dispatchEvent
(
event
);
this
.
updateTargetButtons
(
e
);
};
};
Notes
.
prototype
.
reenableTargetFormSubmitButton
=
function
()
{
Notes
.
prototype
.
reenableTargetFormSubmitButton
=
function
()
{
...
...
spec/javascripts/fixtures/comments.html.haml
0 → 100644
View file @
e7b0334c
.flash-container.timeline-content
.timeline-icon.hidden-xs.hidden-sm
%a
.author_link
%img
.timeline-content.timeline-content-form
%form
.new-note.js-quick-submit.common-note-form.gfm-form.js-main-target-form
.md-area
.md-header
.md-write-holder
.zen-backdrop.div-dropzone-wrapper
.div-dropzone-wrapper
.div-dropzone.dz-clickable
%textarea
.note-textarea.js-note-text.js-gfm-input.js-autosize.markdown-area
.note-form-actions.clearfix
%input
.btn.btn-nr.btn-create.append-right-10.comment-btn.js-comment-button
{
type:
'submit'
}
%a
.btn.btn-nr.btn-reopen.btn-comment.js-note-target-reopen
Reopen issue
%a
.btn.btn-nr.btn-close.btn-comment.js-note-target-close
Close issue
%a
.btn.btn-cancel.js-note-discard
Discard draft
\ No newline at end of file
spec/javascripts/notes_spec.js
View file @
e7b0334c
/*= require notes */
/*= require notes */
/*= require autosize */
/*= require gl_form */
/*= require gl_form */
/*= require lib/utils/text_utility */
(
function
()
{
(
function
()
{
window
.
gon
||
(
window
.
gon
=
{});
window
.
gon
||
(
window
.
gon
=
{});
...
@@ -12,29 +11,63 @@
...
@@ -12,29 +11,63 @@
};
};
describe
(
'
Notes
'
,
function
()
{
describe
(
'
Notes
'
,
function
()
{
return
describe
(
'
task lists
'
,
function
()
{
describe
(
'
task lists
'
,
function
()
{
fixture
.
preload
(
'
issue_note.html
'
);
fixture
.
preload
(
'
issue_note.html
'
);
beforeEach
(
function
()
{
beforeEach
(
function
()
{
fixture
.
load
(
'
issue_note.html
'
);
fixture
.
load
(
'
issue_note.html
'
);
$
(
'
form
'
).
on
(
'
submit
'
,
function
(
e
)
{
$
(
'
form
'
).
on
(
'
submit
'
,
function
(
e
)
{
return
e
.
preventDefault
();
e
.
preventDefault
();
});
});
return
this
.
notes
=
new
Notes
();
this
.
notes
=
new
Notes
();
});
});
it
(
'
modifies the Markdown field
'
,
function
()
{
it
(
'
modifies the Markdown field
'
,
function
()
{
$
(
'
input[type=checkbox]
'
).
attr
(
'
checked
'
,
true
).
trigger
(
'
change
'
);
$
(
'
input[type=checkbox]
'
).
attr
(
'
checked
'
,
true
).
trigger
(
'
change
'
);
return
expect
(
$
(
'
.js-task-list-field
'
).
val
()).
toBe
(
'
- [x] Task List Item
'
);
expect
(
$
(
'
.js-task-list-field
'
).
val
()).
toBe
(
'
- [x] Task List Item
'
);
});
});
return
it
(
'
submits the form on tasklist:changed
'
,
function
()
{
var
submitted
;
it
(
'
submits the form on tasklist:changed
'
,
function
()
{
submitted
=
false
;
var
submitted
=
false
;
$
(
'
form
'
).
on
(
'
submit
'
,
function
(
e
)
{
$
(
'
form
'
).
on
(
'
submit
'
,
function
(
e
)
{
submitted
=
true
;
submitted
=
true
;
return
e
.
preventDefault
();
e
.
preventDefault
();
});
});
$
(
'
.js-task-list-field
'
).
trigger
(
'
tasklist:changed
'
);
$
(
'
.js-task-list-field
'
).
trigger
(
'
tasklist:changed
'
);
return
expect
(
submitted
).
toBe
(
true
);
expect
(
submitted
).
toBe
(
true
);
});
});
describe
(
'
comments
'
,
function
()
{
var
commentsTemplate
=
'
comments.html
'
;
var
textarea
=
'
.js-note-text
'
;
fixture
.
preload
(
commentsTemplate
);
beforeEach
(
function
()
{
fixture
.
load
(
commentsTemplate
);
this
.
notes
=
new
Notes
();
this
.
autoSizeSpy
=
spyOnEvent
(
$
(
textarea
),
'
autosize:update
'
);
spyOn
(
this
.
notes
,
'
renderNote
'
).
and
.
stub
();
$
(
textarea
).
data
(
'
autosave
'
,
{
reset
:
function
()
{}
});
$
(
'
form
'
).
on
(
'
submit
'
,
function
(
e
)
{
e
.
preventDefault
();
$
(
'
.js-main-target-form
'
).
trigger
(
'
ajax:success
'
);
});
});
});
it
(
'
autosizes after comment submission
'
,
function
()
{
$
(
textarea
).
text
(
'
This is an example comment note
'
);
expect
(
this
.
autoSizeSpy
).
not
.
toHaveBeenTriggered
();
$
(
'
.js-comment-button
'
).
click
();
expect
(
this
.
autoSizeSpy
).
toHaveBeenTriggered
();
})
});
});
});
});
...
...
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