Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f72c1bf1
Commit
f72c1bf1
authored
Dec 17, 2016
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs
parent
e197f27f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
30 additions
and
16 deletions
+30
-16
app/assets/javascripts/filtered_search/dropdown_utils.js.es6
app/assets/javascripts/filtered_search/dropdown_utils.js.es6
+9
-4
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
...s/filtered_search/filtered_search_dropdown_manager.js.es6
+11
-4
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
...features/issues/filtered_search/dropdown_assignee_spec.rb
+3
-3
spec/features/issues/filtered_search/dropdown_author_spec.rb
spec/features/issues/filtered_search/dropdown_author_spec.rb
+5
-3
spec/features/issues/filtered_search/dropdown_label_spec.rb
spec/features/issues/filtered_search/dropdown_label_spec.rb
+1
-1
spec/features/issues/filtered_search/filter_issues_spec.rb
spec/features/issues/filtered_search/filter_issues_spec.rb
+1
-1
No files found.
app/assets/javascripts/filtered_search/dropdown_utils.js.es6
View file @
f72c1bf1
...
...
@@ -42,12 +42,17 @@
static filterHint(item, query) {
const updatedItem = item;
const { lastToken } = gl.FilteredSearchTokenizer.processTokens(query);
let { lastToken } = gl.FilteredSearchTokenizer.processTokens(query);
lastToken = lastToken || '';
if (!lastToken) {
if (!lastToken
|| query.split('').last() === ' '
) {
updatedItem.droplab_hidden = false;
} else {
updatedItem.droplab_hidden = updatedItem.hint.indexOf(lastToken.toLowerCase()) === -1;
} else if (lastToken) {
const split = lastToken.split(':');
const tokenName = split[0].split(' ').last();
const match = updatedItem.hint.indexOf(tokenName.toLowerCase()) === -1;
updatedItem.droplab_hidden = tokenName ? match : false;
}
return updatedItem;
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
View file @
f72c1bf1
...
...
@@ -62,6 +62,7 @@
const value = input.value;
const hasExistingValue = value.length !== 0;
const { lastToken, searchToken } = gl.FilteredSearchTokenizer.processTokens(value);
const lastSearchToken = searchToken.split(' ').last();
// Find out what part of the token value the user has typed
// and remove it from input before appending the selected token value
...
...
@@ -74,8 +75,8 @@
// Add 2 length to account for the length of the front and back quotes
const lengthToRemove = hasQuotes ? lastTokenString.length + 2 : lastTokenString.length;
input.value = value.slice(0, -1 * (lengthToRemove));
} else if (searchToken !== '' && word.indexOf(
s
earchToken) !== -1) {
input.value = value.slice(0, -1 *
s
earchToken.length);
} else if (searchToken !== '' && word.indexOf(
lastS
earchToken) !== -1) {
input.value = value.slice(0, -1 *
lastS
earchToken.length);
}
input.value += hasExistingValue && addSpace ? ` ${word}` : word;
...
...
@@ -150,11 +151,17 @@
const { lastToken, searchToken } = this.tokenizer
.processTokens(this.filteredSearchInput.value);
if (lastToken === searchToken) {
if (this.filteredSearchInput.value.split('').last() === ' ') {
this.updateCurrentDropdownOffset();
}
if (lastToken === searchToken && lastToken !== null) {
// Token is not fully initialized yet because it has no value
// Eg. token = 'label:'
const split = lastToken.split(':');
this.loadDropdown(split.length > 1 ? split[0] : '');
const dropdownName = split[0].split(' ').last();
this.loadDropdown(split.length > 1 ? dropdownName : '');
} else if (lastToken) {
// Token has been initialized into an object because it has a value
this.loadDropdown(lastToken.key);
...
...
spec/features/issues/filtered_search/dropdown_assignee_spec.rb
View file @
f72c1bf1
...
...
@@ -13,7 +13,7 @@ describe 'Dropdown assignee', js: true, feature: true do
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
sleep
3
sleep
5
wait_for_ajax
end
end
...
...
@@ -65,7 +65,7 @@ describe 'Dropdown assignee', js: true, feature: true do
describe
'filtering'
do
before
do
filtered_search
.
set
(
'assignee:'
)
send_keys_to_filtered_search
(
'assignee:'
)
end
it
'filters by name'
do
...
...
@@ -118,7 +118,7 @@ describe 'Dropdown assignee', js: true, feature: true do
end
it
'selects `no assignee`'
do
click_assignee
(
'No Assignee'
)
find
(
'#js-dropdown-assignee .filter-dropdown-item'
,
text:
'No Assignee'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_assignee
,
visible:
false
)
expect
(
filtered_search
.
value
).
to
eq
(
"assignee:none"
)
end
...
...
spec/features/issues/filtered_search/dropdown_author_spec.rb
View file @
f72c1bf1
...
...
@@ -13,7 +13,7 @@ describe 'Dropdown author', js: true, feature: true do
def
send_keys_to_filtered_search
(
input
)
input
.
split
(
""
).
each
do
|
i
|
filtered_search
.
send_keys
(
i
)
sleep
3
sleep
5
wait_for_ajax
end
end
...
...
@@ -65,7 +65,8 @@ describe 'Dropdown author', js: true, feature: true do
describe
'filtering'
do
before
do
filtered_search
.
set
(
'author:'
)
filtered_search
.
set
(
'author'
)
send_keys_to_filtered_search
(
':'
)
end
it
'filters by name'
do
...
...
@@ -101,7 +102,8 @@ describe 'Dropdown author', js: true, feature: true do
describe
'selecting from dropdown'
do
before
do
filtered_search
.
set
(
'author:'
)
filtered_search
.
set
(
'author'
)
send_keys_to_filtered_search
(
':'
)
end
it
'fills in the author username when the author has not been filtered'
do
...
...
spec/features/issues/filtered_search/dropdown_label_spec.rb
View file @
f72c1bf1
...
...
@@ -176,7 +176,7 @@ describe 'Dropdown label', js: true, feature: true do
end
it
'selects `no label`'
do
click_label
(
'No Label'
)
find
(
'#js-dropdown-label .filter-dropdown-item'
,
text:
'No Label'
).
click
expect
(
page
).
to
have_css
(
js_dropdown_label
,
visible:
false
)
expect
(
filtered_search
.
value
).
to
eq
(
"label:none"
)
end
...
...
spec/features/issues/filtered_search/filter_issues_spec.rb
View file @
f72c1bf1
...
...
@@ -17,9 +17,9 @@ describe 'Filter issues', js: true, feature: true do
let!
(
:multiple_words_label
)
{
create
(
:label
,
project:
project
,
title:
"Two words"
)
}
let!
(
:closed_issue
)
{
create
(
:issue
,
title:
'bug that is closed'
,
project:
project
,
state: :closed
)
}
let
(
:filtered_search
)
{
find
(
'.filtered-search'
)
}
def
input_filtered_search
(
search_term
)
filtered_search
=
find
(
'.filtered-search'
)
filtered_search
.
set
(
search_term
)
filtered_search
.
send_keys
(
:enter
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment