Skip to content

Commit

Permalink
Show max warning comment lenth again
Browse files Browse the repository at this point in the history
Fixes #7414

Since we no longer use an input field we have to use text instead of
val.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Jan 2, 2018
1 parent fa2fe34 commit 4c0c3c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion apps/comments/js/commentstabview.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@

_onTypeComment: function(ev) {
var $field = $(ev.target);
var len = $field.val().length;
var len = $field.text().length;
var $submitButton = $field.data('submitButtonEl');
if (!$submitButton) {
$submitButton = $field.closest('form').find('.submit');
Expand Down
4 changes: 2 additions & 2 deletions apps/comments/tests/js/commentstabviewSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,15 +411,15 @@ describe('OCA.Comments.CommentsTabView tests', function() {
expect($message.hasClass('error')).toEqual(false);
});
it('displays tooltip when limit is almost reached', function() {
$message.val(createMessageWithLength(view._commentMaxLength - 2));
$message.text(createMessageWithLength(view._commentMaxLength - 2));
$message.trigger('change');

expect(tooltipStub.calledWith('show')).toEqual(true);
expect($submitButton.prop('disabled')).toEqual(false);
expect($message.hasClass('error')).toEqual(false);
});
it('displays tooltip and disabled button when limit is exceeded', function() {
$message.val(createMessageWithLength(view._commentMaxLength + 2));
$message.text(createMessageWithLength(view._commentMaxLength + 2));
$message.trigger('change');

expect(tooltipStub.calledWith('show')).toEqual(true);
Expand Down

0 comments on commit 4c0c3c0

Please sign in to comment.