Commit f9229281 authored by Stan Hu's avatar Stan Hu

Merge branch '40850-ssh-warning-message-appears-in-clone-box' into 'master'

Resolve "SSH warning message appears in clone box"

Closes #40850

See merge request gitlab-org/gitlab-ce!15753
parents 32b18557 92f8c7d8
...@@ -84,7 +84,7 @@ module ButtonHelper ...@@ -84,7 +84,7 @@ module ButtonHelper
button_content << content_tag(:span, description, class: 'dropdown-menu-inner-content') if description button_content << content_tag(:span, description, class: 'dropdown-menu-inner-content') if description
content_tag (href ? :a : :span), content_tag (href ? :a : :span),
button_content, (href ? button_content : title),
class: "#{title.downcase}-selector", class: "#{title.downcase}-selector",
href: (href if href) href: (href if href)
end end
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
.git-clone-holder.input-group .git-clone-holder.input-group
.input-group-btn .input-group-btn
- if allowed_protocols_present? - if allowed_protocols_present?
.clone-dropdown-btn.btn.btn-static .clone-dropdown-btn.btn
%span %span
= enabled_project_button(project, enabled_protocol) = enabled_project_button(project, enabled_protocol)
- else - else
......
...@@ -92,6 +92,34 @@ describe ButtonHelper do ...@@ -92,6 +92,34 @@ describe ButtonHelper do
end end
end end
describe 'ssh and http clone buttons' do
let(:user) { create(:user) }
let(:project) { build_stubbed(:project) }
def http_button_element
element = helper.http_clone_button(project, append_link: false)
Nokogiri::HTML::DocumentFragment.parse(element).first_element_child
end
def ssh_button_element
element = helper.ssh_clone_button(project, append_link: false)
Nokogiri::HTML::DocumentFragment.parse(element).first_element_child
end
before do
allow(helper).to receive(:current_user).and_return(user)
end
it 'only shows the title of any of the clone buttons when append_link is false' do
expect(http_button_element.text).to eq('HTTP')
expect(http_button_element.search('.dropdown-menu-inner-content').first).to eq(nil)
expect(ssh_button_element.text).to eq('SSH')
expect(ssh_button_element.search('.dropdown-menu-inner-content').first).to eq(nil)
end
end
describe 'clipboard_button' do describe 'clipboard_button' do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { build_stubbed(:project) } let(:project) { build_stubbed(:project) }
......
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