Commit 1f508334 by Phil Hughes

Updated tests

parent ccc64676
......@@ -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)
......
......@@ -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
......
......@@ -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
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