Commit 1f508334 authored by Phil Hughes's avatar Phil Hughes

Updated tests

parent ccc64676
...@@ -65,6 +65,8 @@ class @Notes ...@@ -65,6 +65,8 @@ class @Notes
# add diff note # add diff note
$(document).on "click", ".js-add-diff-note-button", @addDiffNote $(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 # hide diff note form
$(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm $(document).on "click", ".js-close-discussion-note-form", @cancelDiscussionForm
...@@ -264,6 +266,8 @@ class @Notes ...@@ -264,6 +266,8 @@ class @Notes
form.removeClass "js-new-note-form" form.removeClass "js-new-note-form"
form.addClass "js-main-target-form" form.addClass "js-main-target-form"
form.find("#note_line_code").remove()
### ###
General note form setup. General note form setup.
...@@ -500,8 +504,9 @@ class @Notes ...@@ -500,8 +504,9 @@ class @Notes
### ###
addDiffNote: (e) => addDiffNote: (e) =>
e.preventDefault() e.preventDefault()
link = e.currentTarget $link = $(e.currentTarget)
row = $(link).closest("tr") console.log $link.data('line-code')
row = $link.closest("tr")
nextRow = row.next() nextRow = row.next()
hasNotes = nextRow.is(".notes_holder") hasNotes = nextRow.is(".notes_holder")
addForm = false addForm = false
...@@ -510,7 +515,7 @@ class @Notes ...@@ -510,7 +515,7 @@ class @Notes
# In parallel view, look inside the correct left/right pane # In parallel view, look inside the correct left/right pane
if @isParallelView() if @isParallelView()
lineType = $(link).data("lineType") lineType = $link.data("lineType")
targetContent += "." + 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>" 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 ...@@ -536,7 +541,7 @@ class @Notes
newForm.appendTo row.next().find(targetContent) newForm.appendTo row.next().find(targetContent)
# show the form # show the form
@setupDiscussionNoteForm $(link), newForm @setupDiscussionNoteForm $link, newForm
### ###
Called in response to "cancel" on a diff note form. Called in response to "cancel" on a diff note form.
...@@ -561,7 +566,6 @@ class @Notes ...@@ -561,7 +566,6 @@ class @Notes
cancelDiscussionForm: (e) => cancelDiscussionForm: (e) =>
e.preventDefault() e.preventDefault()
form = $(".js-new-note-form")
form = $(e.target).closest(".js-discussion-note-form") form = $(e.target).closest(".js-discussion-note-form")
@removeDiscussionNoteForm(form) @removeDiscussionNoteForm(form)
......
...@@ -128,7 +128,7 @@ module SharedNote ...@@ -128,7 +128,7 @@ module SharedNote
end end
step 'I edit the last comment with a +1' do step 'I edit the last comment with a +1' do
page.within(".notes") do page.within(".main-notes-list") do
find(".note").hover find(".note").hover
find('.js-note-edit').click find('.js-note-edit').click
end end
......
...@@ -225,6 +225,6 @@ describe 'Comments', feature: true do ...@@ -225,6 +225,6 @@ describe 'Comments', feature: true do
end end
def click_diff_line(data = line_code) 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
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment