Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
f72c1bf1
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f72c1bf1
编写于
12月 17, 2016
作者:
C
Clement Ho
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix specs
上级
e197f27f
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
30 addition
and
16 deletion
+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
未找到文件。
app/assets/javascripts/filtered_search/dropdown_utils.js.es6
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录