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

dropdown_author_spec.rb « filtered_search « issues « features « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b5d389b3beeefbe3c45e0613b802b0a372b408ee (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Dropdown author', :js, feature_category: :team_planning do
  include FilteredSearchHelpers

  let_it_be(:project) { create(:project) }
  let_it_be(:user) { create(:user) }
  let_it_be(:issue) { create(:issue, project: project) }

  before do
    stub_feature_flags(or_issuable_queries: false)
    project.add_maintainer(user)
    sign_in(user)

    visit project_issues_path(project)
  end

  describe 'behavior' do
    it 'loads all the authors when opened' do
      select_tokens 'Author', '='

      expect_suggestion_count 2
    end

    it 'shows current user at top of dropdown' do
      select_tokens 'Author', '='

      expect(page).to have_css('.gl-filtered-search-suggestion:first-child', text: user.name)
    end
  end

  describe 'selecting from dropdown without Ajax call' do
    before do
      Gitlab::Testing::RequestBlockerMiddleware.block_requests!
      select_tokens 'Author', '='
    end

    after do
      Gitlab::Testing::RequestBlockerMiddleware.allow_requests!
    end

    it 'selects current user' do
      click_on user.username

      expect_author_token(user.username)
      expect_empty_search_term
    end
  end
end