debian-mirror-gitlab/spec/helpers/external_link_helper_spec.rb

21 lines
843 B
Ruby
Raw Normal View History

2019-12-04 20:38:33 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe ExternalLinkHelper do
2019-12-04 20:38:33 +05:30
include IconsHelper
it 'returns external link with icon' do
2021-01-03 14:25:43 +05:30
link = external_link('https://gitlab.com', 'https://gitlab.com').to_s
expect(link).to start_with('<a target="_blank" rel="noopener noreferrer" href="https://gitlab.com">https://gitlab.com')
expect(link).to include('data-testid="external-link-icon"')
2019-12-04 20:38:33 +05:30
end
it 'allows options when creating external link with icon' do
2021-01-03 14:25:43 +05:30
link = external_link('https://gitlab.com', 'https://gitlab.com', { "data-foo": "bar", class: "externalLink" }).to_s
expect(link).to start_with('<a target="_blank" rel="noopener noreferrer" data-foo="bar" class="externalLink" href="https://gitlab.com">https://gitlab.com')
expect(link).to include('data-testid="external-link-icon"')
2019-12-04 20:38:33 +05:30
end
end