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

markdown_toolbar_spec.rb « issues « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5cabaf1696083be7364db936a5ba0ca1a2fcbe4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Issue markdown toolbar', :js, feature_category: :team_planning do
  let_it_be(:project) { create(:project, :public) }
  let_it_be(:issue)   { create(:issue, project: project) }
  let_it_be(:user)    { create(:user) }

  before do
    sign_in(user)

    visit project_issue_path(project, issue)
  end

  it "doesn't include first new line when adding bold" do
    fill_in 'Comment', with: "test\nbold"

    page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 9)')

    click_button 'Add bold text'

    expect(find_field('Comment').value).to eq("test\n**bold**\n")
  end

  it "doesn't include first new line when adding underline" do
    fill_in 'Comment', with: "test\nunderline"

    page.evaluate_script('document.getElementById("note-body").setSelectionRange(4, 50)')

    click_button 'Add italic text'

    expect(find_field('Comment').value).to eq("test\n_underline_\n")
  end
end