blob: 36a8f1f390290706cc1caff0a0df2064b0271d09 (
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
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Dropdown author', :js 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
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
|