summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2015-12-09 11:30:21 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2015-12-09 11:30:21 -0200
commit9e5ac7285cc6b9b641d863457086b2e5292699e1 (patch)
tree53d86b8798e125e0b9361823321fe7513ea08c87
parent9bfd6c44e23754b6f699586f6a0cec2879e107e0 (diff)
downloadgitlab-ce-9e5ac7285cc6b9b641d863457086b2e5292699e1.tar.gz
Ensure notes are replaced on a merge request diff when they're updated
-rw-r--r--app/assets/javascripts/notes.js.coffee2
-rw-r--r--features/project/merge_requests.feature10
-rw-r--r--features/steps/project/merge_requests.rb25
3 files changed, 36 insertions, 1 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 533d00bfb0c..5fe0318de6f 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -286,7 +286,7 @@ class @Notes
$html.find('.js-task-list-container').taskList('enable')
# Find the note's `li` element by ID and replace it with the updated HTML
- $note_li = $("#note_#{note.id}")
+ $note_li = $('.note-row-' + note.id)
$note_li.replaceWith($html)
###
diff --git a/features/project/merge_requests.feature b/features/project/merge_requests.feature
index 6cd081c868e..5a7f7f7c642 100644
--- a/features/project/merge_requests.feature
+++ b/features/project/merge_requests.feature
@@ -84,6 +84,16 @@ Feature: Project Merge Requests
Then I should see a discussion has started on diff
@javascript
+ Scenario: I edit a comment on a merge request diff
+ Given project "Shop" have "Bug NS-05" open merge request with diffs inside
+ And I visit merge request page "Bug NS-05"
+ And I click on the Changes tab
+ And I leave a comment like "Line is wrong" on diff
+ And I change the comment "Line is wrong" to "Typo, please fix" on diff
+ Then I should not see a diff comment saying "Line is wrong"
+ And I should see a diff comment saying "Typo, please fix"
+
+ @javascript
Scenario: I comment on a line of a commit in merge request
Given project "Shop" have "Bug NS-05" open merge request with diffs inside
And I visit merge request page "Bug NS-05"
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index 822cf0ffe1c..74539d0b019 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -186,6 +186,31 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
leave_comment "Line is wrong"
end
+ step 'I change the comment "Line is wrong" to "Typo, please fix" on diff' do
+ page.within('.diff-file:nth-of-type(5) .note') do
+ find('.js-note-edit').click
+
+ page.within('.current-note-edit-form', visible: true) do
+ fill_in 'note_note', with: 'Typo, please fix'
+ click_button 'Save Comment'
+ end
+
+ expect(page).not_to have_button 'Save Comment', disabled: true, visible: true
+ end
+ end
+
+ step 'I should not see a diff comment saying "Line is wrong"' do
+ page.within('.diff-file:nth-of-type(5) .note') do
+ expect(page).not_to have_visible_content 'Line is wrong'
+ end
+ end
+
+ step 'I should see a diff comment saying "Typo, please fix"' do
+ page.within('.diff-file:nth-of-type(5) .note') do
+ expect(page).to have_visible_content 'Typo, please fix'
+ end
+ end
+
step 'I should see a discussion has started on diff' do
page.within(".notes .discussion") do
page.should have_content "#{current_user.name} started a discussion"