diff --git a/apps/comments/js/commentstabview.js b/apps/comments/js/commentstabview.js index 4ffa76112a1bf01d8c574a729c64aed7b4254808..7398a709421d5680263ca6ef9e6ec15f37a1fef3 100644 Binary files a/apps/comments/js/commentstabview.js and b/apps/comments/js/commentstabview.js differ diff --git a/apps/comments/tests/js/commentstabviewSpec.js b/apps/comments/tests/js/commentstabviewSpec.js index 63a27956f9f99e75cb81f7498a824ad0e00306c0..8b99ad081cd0e9ccc76e6ca5f16e82bc4efc6ef8 100644 --- a/apps/comments/tests/js/commentstabviewSpec.js +++ b/apps/comments/tests/js/commentstabviewSpec.js @@ -157,7 +157,7 @@ describe('OCA.Comments.CommentsTabView tests', function() { expect($comment.find('.avatar[data-user=macbeth] ~ .contactsmenu-popover').length).toEqual(1); expect($comment.find('.avatar[data-user=banquo]').length).toEqual(1); - expect($comment.find('.avatar-name-wrapper:last-child strong').text()).toEqual('Lord Banquo'); + expect($comment.find('.avatar[data-user=banquo] ~ strong').text()).toEqual('Lord Banquo'); expect($comment.find('.avatar[data-user=banquo] ~ .contactsmenu-popover').length).toEqual(1); }); @@ -239,7 +239,7 @@ describe('OCA.Comments.CommentsTabView tests', function() { }); it('creates a new comment when clicking post button', function() { - view.$el.find('.message').val('New message'); + view.$el.find('.message').text('New message'); view.$el.find('form').submit(); expect(createStub.calledOnce).toEqual(true); @@ -253,7 +253,7 @@ describe('OCA.Comments.CommentsTabView tests', function() { }); }); it('creates a new comment with mentions when clicking post button', function() { - view.$el.find('.message').val('New message @anotheruser'); + view.$el.find('.message').text('New message @anotheruser'); view.$el.find('form').submit(); var createStubExpectedData = { @@ -439,7 +439,7 @@ describe('OCA.Comments.CommentsTabView tests', function() { var $formRow = view.$el.find('.newCommentRow.comment[data-id=1]'); expect($formRow.length).toEqual(1); - $formRow.find('textarea').val('modified message'); + $formRow.find('div.message').text('modified message'); $formRow.find('form').submit(); expect(saveStub.calledOnce).toEqual(true); @@ -451,8 +451,9 @@ describe('OCA.Comments.CommentsTabView tests', function() { // simulate the fact that save sets the attribute model.set('message', 'modified\nmessage'); saveStub.yieldTo('success', model); + view.collection.get(model); - expect(fetchStub.calledOnce).toEqual(true); + expect(fetchStub.called).toEqual(true); fetchStub.yieldTo('success', model); // original comment element is visible again @@ -472,7 +473,7 @@ describe('OCA.Comments.CommentsTabView tests', function() { var $formRow = view.$el.find('.newCommentRow.comment[data-id=3]'); expect($formRow.length).toEqual(1); - $formRow.find('textarea').val('modified\nmessage @anotheruser'); + $formRow.find('div.message').text('modified\nmessage @anotheruser'); $formRow.find('form').submit(); expect(saveStub.calledOnce).toEqual(true); @@ -485,7 +486,7 @@ describe('OCA.Comments.CommentsTabView tests', function() { model.set('message', 'modified\nmessage @anotheruser'); saveStub.yieldTo('success', model); - expect(fetchStub.calledOnce).toEqual(true); + expect(fetchStub.called).toEqual(true); // simulate the fact that fetch sets the attribute model.set('mentions', { diff --git a/tests/karma.config.js b/tests/karma.config.js index 07dc2965346a73ff638f2beb1f8d1b6fbb433e7f..fb613857e919ad48077eb4cd5731b9f6c548da61 100644 --- a/tests/karma.config.js +++ b/tests/karma.config.js @@ -88,6 +88,8 @@ module.exports = function(config) { srcFiles: [ // need to enforce loading order... 'apps/comments/js/app.js', + 'apps/comments/js/vendor/Caret.js/dist/jquery.caret.min.js', + 'apps/comments/js/vendor/At.js/dist/js/jquery.atwho.min.js', 'apps/comments/js/commentmodel.js', 'apps/comments/js/commentcollection.js', 'apps/comments/js/commentsummarymodel.js',