summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2016-03-30 20:11:41 +0100
committerPhil Hughes <me@iamphill.com>2016-04-04 10:48:49 +0100
commit1f5083343081adb6e4a9a438600163844d2e9875 (patch)
tree9f6352f9d751661ca50c165c6b35f4591444a85f
parentccc64676a97d251658190bfb62e97b166cee4db1 (diff)
downloadgitlab-ce-1f5083343081adb6e4a9a438600163844d2e9875.tar.gz
Updated tests
-rw-r--r--app/assets/javascripts/notes.js.coffee14
-rw-r--r--features/steps/shared/note.rb2
-rw-r--r--spec/features/notes_on_merge_requests_spec.rb2
3 files changed, 11 insertions, 7 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee
index 0ee1e70da2c..35547adf8a4 100644
--- a/app/assets/javascripts/notes.js.coffee
+++ b/app/assets/javascripts/notes.js.coffee
@@ -65,6 +65,8 @@ class @Notes
# add diff note
$(document).on "click", ".js-add-diff-note-button", @addDiffNote
+ $(document).on "mouseover", ".js-add-diff-note-button", ->
+ console.log $(this).data('line-code')
# hide diff note form
$(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm
@@ -264,6 +266,8 @@ class @Notes
form.removeClass "js-new-note-form"
form.addClass "js-main-target-form"
+ form.find("#note_line_code").remove()
+
###
General note form setup.
@@ -500,8 +504,9 @@ class @Notes
###
addDiffNote: (e) =>
e.preventDefault()
- link = e.currentTarget
- row = $(link).closest("tr")
+ $link = $(e.currentTarget)
+ console.log $link.data('line-code')
+ row = $link.closest("tr")
nextRow = row.next()
hasNotes = nextRow.is(".notes_holder")
addForm = false
@@ -510,7 +515,7 @@ class @Notes
# In parallel view, look inside the correct left/right pane
if @isParallelView()
- lineType = $(link).data("lineType")
+ lineType = $link.data("lineType")
targetContent += "." + lineType
rowCssToAdd = "<tr class=\"notes_holder js-temp-notes-holder\"><td class=\"notes_line\"></td><td class=\"notes_content parallel old\"></td><td class=\"notes_line\"></td><td class=\"notes_content parallel new\"></td></tr>"
@@ -536,7 +541,7 @@ class @Notes
newForm.appendTo row.next().find(targetContent)
# show the form
- @setupDiscussionNoteForm $(link), newForm
+ @setupDiscussionNoteForm $link, newForm
###
Called in response to "cancel" on a diff note form.
@@ -561,7 +566,6 @@ class @Notes
cancelDiscussionForm: (e) =>
e.preventDefault()
- form = $(".js-new-note-form")
form = $(e.target).closest(".js-discussion-note-form")
@removeDiscussionNoteForm(form)
diff --git a/features/steps/shared/note.rb b/features/steps/shared/note.rb
index 7949d252f04..a3c3887ab46 100644
--- a/features/steps/shared/note.rb
+++ b/features/steps/shared/note.rb
@@ -128,7 +128,7 @@ module SharedNote
end
step 'I edit the last comment with a +1' do
- page.within(".notes") do
+ page.within(".main-notes-list") do
find(".note").hover
find('.js-note-edit').click
end
diff --git a/spec/features/notes_on_merge_requests_spec.rb b/spec/features/notes_on_merge_requests_spec.rb
index 133fca6923c..70d0864783d 100644
--- a/spec/features/notes_on_merge_requests_spec.rb
+++ b/spec/features/notes_on_merge_requests_spec.rb
@@ -225,6 +225,6 @@ describe 'Comments', feature: true do
end
def click_diff_line(data = line_code)
- page.find(%Q{button[data-line-code="#{data}"]}, visible: false).click
+ execute_script("$('button[data-line-code=\"#{data}\"]').click()")
end
end