summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-09-27 15:38:13 +0100
committerPhil Hughes <me@iamphill.com>2017-09-27 15:38:13 +0100
commitfe24c0a875fa1d6f561a5b228cf71d0c9da671af (patch)
tree3178f947489608facfc2dfd2b509ac8e8e3d8d6e /spec/features
parentaaf435d16435bf3fbcfc2ab80071485ddb6bcf01 (diff)
downloadgitlab-ce-commit-side-by-side-comment.tar.gz
Fixes commit comments in side-by-side diff viewcommit-side-by-side-comment
This was caused by the `notes` global class not existing when the `file_comment_button` code is run. The notes class was used to check if the diff is currently in parallel view or not. To get around this I've added a check into the `file_comment_button` JS to check if the view is currently parallel or not. Closes #38117
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/projects/commit/diff_notes_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/features/projects/commit/diff_notes_spec.rb b/spec/features/projects/commit/diff_notes_spec.rb
new file mode 100644
index 00000000000..f0fe4e00acc
--- /dev/null
+++ b/spec/features/projects/commit/diff_notes_spec.rb
@@ -0,0 +1,36 @@
+require 'spec_helper'
+
+feature 'Commit diff', :js do
+ include RepoHelpers
+
+ let(:user) { create(:user) }
+ let(:project) { create(:project, :public, :repository) }
+
+ before do
+ project.add_master(user)
+ sign_in user
+ end
+
+ %w(inline parallel).each do |view|
+ context "#{view} view" do
+ before do
+ visit project_commit_path(project, sample_commit.id, view: view)
+ end
+
+ it "adds comment to diff" do
+ diff_line_num = first('.diff-line-num.new')
+
+ diff_line_num.trigger('mouseover')
+ diff_line_num.find('.js-add-diff-note-button').trigger('click')
+
+ page.within(first('.diff-viewer')) do
+ find('.js-note-text').set 'test comment'
+
+ click_button 'Comment'
+
+ expect(page).to have_content('test comment')
+ end
+ end
+ end
+ end
+end