Commit da6e38a8 authored by Phil Hughes's avatar Phil Hughes

Fixed tests for comment forms

parent e033b9a7
...@@ -470,6 +470,11 @@ class @Notes ...@@ -470,6 +470,11 @@ class @Notes
form.find("#note_line_code").val dataHolder.data("lineCode") form.find("#note_line_code").val dataHolder.data("lineCode")
form.find("#note_noteable_type").val dataHolder.data("noteableType") form.find("#note_noteable_type").val dataHolder.data("noteableType")
form.find("#note_noteable_id").val dataHolder.data("noteableId") form.find("#note_noteable_id").val dataHolder.data("noteableId")
form.find('.js-note-discard')
.show()
.removeClass('js-note-discard')
.addClass('js-close-discussion-note-form')
.text(form.find('.js-close-discussion-note-form').data('cancel-text'))
@setupNoteForm form @setupNoteForm form
form.find(".js-note-text").focus() form.find(".js-note-text").focus()
form.addClass "js-discussion-note-form" form.addClass "js-discussion-note-form"
......
...@@ -15,5 +15,5 @@ ...@@ -15,5 +15,5 @@
.note-form-actions.clearfix .note-form-actions.clearfix
= f.submit 'Comment', class: "btn btn-nr btn-create comment-btn btn-grouped js-comment-button" = f.submit 'Comment', class: "btn btn-nr btn-create comment-btn btn-grouped js-comment-button"
= yield(:note_actions) = yield(:note_actions)
%a.btn.btn-cancel.js-note-discard{role: "button"} %a.btn.btn-cancel.js-note-discard{role: "button", data: {cancel_text: "Cancel"}}
Discard draft Discard draft
...@@ -77,7 +77,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps ...@@ -77,7 +77,7 @@ class Spinach::Features::ProjectSnippets < Spinach::FeatureSteps
step 'I leave a comment like "Good snippet!"' do step 'I leave a comment like "Good snippet!"' do
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in "note_note", with: "Good snippet!" fill_in "note_note", with: "Good snippet!"
click_button "Add Comment" click_button "Comment"
end end
end end
......
...@@ -22,7 +22,7 @@ describe 'Comments', feature: true do ...@@ -22,7 +22,7 @@ describe 'Comments', feature: true do
it 'should be valid' do it 'should be valid' do
is_expected.to have_css('.js-main-target-form', visible: true, count: 1) is_expected.to have_css('.js-main-target-form', visible: true, count: 1)
expect(find('.js-main-target-form input[type=submit]').value). expect(find('.js-main-target-form input[type=submit]').value).
to eq('Add Comment') to eq('Comment')
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
expect(page).not_to have_link('Cancel') expect(page).not_to have_link('Cancel')
end end
...@@ -49,7 +49,7 @@ describe 'Comments', feature: true do ...@@ -49,7 +49,7 @@ describe 'Comments', feature: true do
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in 'note[note]', with: 'This is awsome!' fill_in 'note[note]', with: 'This is awsome!'
find('.js-md-preview-button').click find('.js-md-preview-button').click
click_button 'Add Comment' click_button 'Comment'
end end
end end
...@@ -202,7 +202,7 @@ describe 'Comments', feature: true do ...@@ -202,7 +202,7 @@ describe 'Comments', feature: true do
before do before do
page.within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do page.within("tr[id='#{line_code_2}'] + .js-temp-notes-holder") do
fill_in 'note[note]', with: 'Another comment on line 10' fill_in 'note[note]', with: 'Another comment on line 10'
click_button('Add Comment') click_button('Comment')
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