blob: dcbab308efaccef9d7f872209dfc87de7e92eeae (
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Dropdown hint', :js do
include FilteredSearchHelpers
let_it_be(:project) { create(:project, :public) }
let_it_be(:user) { create(:user) }
let_it_be(:issue) { create(:issue, project: project) }
before do
project.add_maintainer(user)
end
context 'when user not logged in' do
before do
visit project_issues_path(project)
end
it 'does not exist my-reaction dropdown item' do
click_filtered_search_bar
expect(page).not_to have_link 'My-reaction'
end
end
context 'when user logged in' do
before do
sign_in(user)
visit project_issues_path(project)
end
describe 'behavior' do
before do
click_filtered_search_bar
end
it 'opens when the search bar is first focused' do
expect_visible_suggestions_list
find('body').click
expect_hidden_suggestions_list
end
end
describe 'filtering' do
it 'filters with text' do
click_filtered_search_bar
send_keys 'as'
# Expect Assignee and Release
expect_suggestion_count 2
end
end
describe 'selecting from dropdown with no input' do
before do
click_filtered_search_bar
end
it 'opens the token dropdown when you click on it' do
click_link 'Author'
expect_visible_suggestions_list
expect_suggestion '='
click_link '= is'
expect_visible_suggestions_list
expect_token_segment 'Author'
expect_token_segment '='
expect_empty_search_term
end
end
describe 'reselecting from dropdown' do
it 'reuses existing token text' do
click_filtered_search_bar
send_keys 'author', :backspace, :backspace
click_link 'Author'
expect_token_segment 'Author'
expect_empty_search_term
end
end
end
end
|