Commit 6e328d55 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #7793 from cirosantilli/replace-javascript

Replace javascript:; links with buttons.
parents e5fb2ad9 778afb69
...@@ -145,6 +145,7 @@ ul.notes { ...@@ -145,6 +145,7 @@ ul.notes {
.diff-file tr.line_holder { .diff-file tr.line_holder {
.add-diff-note { .add-diff-note {
background: image-url("diff_note_add.png") no-repeat left 0; background: image-url("diff_note_add.png") no-repeat left 0;
border: none;
height: 22px; height: 22px;
margin-left: -65px; margin-left: -65px;
position: absolute; position: absolute;
......
...@@ -52,8 +52,8 @@ module NotesHelper ...@@ -52,8 +52,8 @@ module NotesHelper
discussion_id: discussion_id discussion_id: discussion_id
} }
link_to "", "javascript:;", class: "add-diff-note js-add-diff-note-button", button_tag '', class: 'btn add-diff-note js-add-diff-note-button',
data: data, title: "Add a comment to this line" data: data, title: 'Add a comment to this line'
end end
def link_to_reply_diff(note) def link_to_reply_diff(note)
...@@ -67,8 +67,8 @@ module NotesHelper ...@@ -67,8 +67,8 @@ module NotesHelper
discussion_id: note.discussion_id discussion_id: note.discussion_id
} }
link_to "javascript:;", class: "btn reply-btn js-discussion-reply-button", button_tag class: 'btn reply-btn js-discussion-reply-button',
data: data, title: "Add a reply" do data: data, title: 'Add a reply' do
link_text = content_tag(:i, nil, class: 'icon-comment') link_text = content_tag(:i, nil, class: 'icon-comment')
link_text << ' Reply' link_text << ' Reply'
end end
......
...@@ -4,6 +4,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -4,6 +4,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
include SharedNote include SharedNote
include SharedPaths include SharedPaths
include SharedMarkdown include SharedMarkdown
include SharedDiffNote
step 'I click link "New Merge Request"' do step 'I click link "New Merge Request"' do
click_link "New Merge Request" click_link "New Merge Request"
...@@ -292,8 +293,4 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps ...@@ -292,8 +293,4 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
def have_visible_content (text) def have_visible_content (text)
have_css("*", text: text, visible: true) have_css("*", text: text, visible: true)
end end
def click_diff_line(code)
find("a[data-line-code='#{code}']").click
end
end end
...@@ -103,7 +103,7 @@ module SharedDiffNote ...@@ -103,7 +103,7 @@ module SharedDiffNote
step 'I should see a discussion reply button' do step 'I should see a discussion reply button' do
within(diff_file_selector) do within(diff_file_selector) do
page.should have_link("Reply") page.should have_button('Reply')
end end
end end
...@@ -160,6 +160,6 @@ module SharedDiffNote ...@@ -160,6 +160,6 @@ module SharedDiffNote
end end
def click_diff_line(code) def click_diff_line(code)
find("a[data-line-code='#{code}']").click find("button[data-line-code='#{code}']").click
end end
end end
...@@ -133,7 +133,7 @@ describe 'Comments' do ...@@ -133,7 +133,7 @@ describe 'Comments' do
describe "when adding a note" do describe "when adding a note" do
before do before do
find("a[data-line-code=\"#{line_code}\"]").click click_diff_line
end end
describe "the notes holder" do describe "the notes holder" do
...@@ -144,7 +144,7 @@ describe 'Comments' do ...@@ -144,7 +144,7 @@ describe 'Comments' do
describe "the note form" do describe "the note form" do
it "shouldn't add a second form for same row" do it "shouldn't add a second form for same row" do
find("a[data-line-code=\"#{line_code}\"]").click click_diff_line
should have_css("tr[id='#{line_code}'] + .js-temp-notes-holder form", count: 1) should have_css("tr[id='#{line_code}'] + .js-temp-notes-holder form", count: 1)
end end
...@@ -161,8 +161,8 @@ describe 'Comments' do ...@@ -161,8 +161,8 @@ describe 'Comments' do
describe "with muliple note forms" do describe "with muliple note forms" do
before do before do
find("a[data-line-code=\"#{line_code}\"]").click click_diff_line
find("a[data-line-code=\"#{line_code_2}\"]").click click_diff_line(line_code_2)
end end
it { should have_css(".js-temp-notes-holder", count: 2) } it { should have_css(".js-temp-notes-holder", count: 2) }
...@@ -193,7 +193,7 @@ describe 'Comments' do ...@@ -193,7 +193,7 @@ describe 'Comments' do
should have_content("Another comment on line 10") should have_content("Another comment on line 10")
should have_css(".notes_holder") should have_css(".notes_holder")
should have_css(".notes_holder .note", count: 1) should have_css(".notes_holder .note", count: 1)
should have_link("Reply") should have_button('Reply')
end end
end end
end end
...@@ -206,4 +206,9 @@ describe 'Comments' do ...@@ -206,4 +206,9 @@ describe 'Comments' do
def line_code_2 def line_code_2
sample_compare.changes.last[:line_code] sample_compare.changes.last[:line_code]
end end
def click_diff_line(data = nil)
data ||= line_code
find("button[data-line-code=\"#{data}\"]").click
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