save comment when another attribe change

stable
Juanfran 2016-05-13 13:01:28 +02:00
parent d264c2db2d
commit 190d0287d1
3 changed files with 27 additions and 3 deletions

View File

@ -293,10 +293,18 @@ class QueueModelTransformation extends taiga.Service
defered = @q.defer() defered = @q.defer()
@qqueue.add () => @qqueue.add () =>
obj = @.getObj()
comment = obj.comment
obj.comment = ''
clone = @.clone() clone = @.clone()
transformation(clone) transformation(clone)
if comment.length
clone.comment = comment
success = () => success = () =>
@.scope[@.prop] = clone @.scope[@.prop] = clone

View File

@ -158,11 +158,15 @@ helper.history = function() {
}, },
addComment: async function(comment) { addComment: async function(comment) {
el.$('textarea[tg-markitup]').sendKeys(comment); obj.writeComment(comment);
el.$('.save-comment').click(); el.$('.save-comment').click();
await browser.waitForAngular(); await browser.waitForAngular();
}, },
writeComment: function(comment) {
el.$('textarea[tg-markitup]').sendKeys(comment);
},
countComments: async function() { countComments: async function() {
let moreComments = el.$('.comments-list .show-more-comments'); let moreComments = el.$('.comments-list .show-more-comments');
let moreCommentsIsPresent = await moreComments.isPresent(); let moreCommentsIsPresent = await moreComments.isPresent();

View File

@ -209,14 +209,26 @@ shared.historyTesting = async function() {
let newDeletedCommentsCounter = await historyHelper.countDeletedComments(); let newDeletedCommentsCounter = await historyHelper.countDeletedComments();
expect(newDeletedCommentsCounter).to.be.equal(deletedCommentsCounter+1); expect(newDeletedCommentsCounter).to.be.equal(deletedCommentsCounter+1);
//Restore last coment //Restore last comment
deletedCommentsCounter = await historyHelper.countDeletedComments(); deletedCommentsCounter = await historyHelper.countDeletedComments();
await historyHelper.restoreLastComment(); await historyHelper.restoreLastComment();
newDeletedCommentsCounter = await historyHelper.countDeletedComments(); newDeletedCommentsCounter = await historyHelper.countDeletedComments();
expect(newDeletedCommentsCounter).to.be.equal(deletedCommentsCounter-1); expect(newDeletedCommentsCounter).to.be.equal(deletedCommentsCounter-1);
//Store comment with a modification
commentsCounter = await historyHelper.countComments();
historyHelper.writeComment("New comment " + date);
let title = detailHelper.title();
title.setTitle('changed');
title.save();
newCommentsCounter = await historyHelper.countComments();
expect(newCommentsCounter).to.be.equal(commentsCounter+1);
//Check activity //Check activity
historyHelper.selectActivityTab(); await historyHelper.selectActivityTab();
let activitiesCounter = await historyHelper.countActivities(); let activitiesCounter = await historyHelper.countActivities();