Welcome to mirror list, hosted at ThFree Co, Russian Federation.

external_link_helper_spec.rb « helpers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f5bb0568824ac51f27852be7c0b0eedf6704860d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe ExternalLinkHelper do
  include IconsHelper

  it 'returns external link with icon' do
    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"')
  end

  it 'allows options when creating external link with icon' do
    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"')
  end
end