Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
b31f9102
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,发现更多精彩内容 >>
提交
b31f9102
编写于
2月 13, 2017
作者:
P
Phil Hughes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added ordering feature specs
上级
db0253cf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
161 addition
and
6 deletion
+161
-6
app/assets/javascripts/boards/components/board_list.js.es6
app/assets/javascripts/boards/components/board_list.js.es6
+1
-1
app/assets/javascripts/boards/models/list.js.es6
app/assets/javascripts/boards/models/list.js.es6
+4
-1
app/assets/javascripts/boards/stores/boards_store.js.es6
app/assets/javascripts/boards/stores/boards_store.js.es6
+4
-4
app/assets/javascripts/test_utils/simulate_drag.js
app/assets/javascripts/test_utils/simulate_drag.js
+11
-0
spec/features/boards/issue_ordering_spec.rb
spec/features/boards/issue_ordering_spec.rb
+141
-0
未找到文件。
app/assets/javascripts/boards/components/board_list.js.es6
浏览文件 @
b31f9102
...
...
@@ -101,7 +101,7 @@ require('./board_new_issue');
});
},
onUpdate: (e) => {
gl.issueBoards.BoardsStore.moveIssueInList(this.list, Store.moving.issue,
this.sortable.toArray(), e.newIndex
);
gl.issueBoards.BoardsStore.moveIssueInList(this.list, Store.moving.issue,
e.oldIndex, e.newIndex, this.sortable.toArray()
);
},
});
...
...
app/assets/javascripts/boards/models/list.js.es6
浏览文件 @
b31f9102
...
...
@@ -142,7 +142,10 @@ class List {
}
}
moveIssue (issue, moveBeforeIid, moveAfterIid) {
moveIssue (issue, oldIndex, newIndex, moveBeforeIid, moveAfterIid) {
this.issues.splice(oldIndex, 1);
this.issues.splice(newIndex, 0, issue);
gl.boardService.moveIssue(issue.id, null, null, moveAfterIid, moveBeforeIid);
}
...
...
app/assets/javascripts/boards/stores/boards_store.js.es6
浏览文件 @
b31f9102
...
...
@@ -106,11 +106,11 @@
listFrom.removeIssue(issue);
}
},
moveIssueInList (list, issue,
idArray, index
) {
const beforeId = parseInt(idArray[
i
ndex - 1], 10) || null;
const afterId = parseInt(idArray[
i
ndex + 1], 10) || null;
moveIssueInList (list, issue,
oldIndex, newIndex, idArray
) {
const beforeId = parseInt(idArray[
newI
ndex - 1], 10) || null;
const afterId = parseInt(idArray[
newI
ndex + 1], 10) || null;
list.moveIssue(issue, beforeId, afterId);
list.moveIssue(issue,
oldIndex, newIndex,
beforeId, afterId);
},
findList (key, val, type = 'label') {
return this.state.lists.filter((list) => {
...
...
app/assets/javascripts/test_utils/simulate_drag.js
浏览文件 @
b31f9102
...
...
@@ -55,6 +55,13 @@
);
}
function
isLast
(
target
)
{
var
el
=
typeof
target
.
el
===
'
string
'
?
document
.
getElementById
(
target
.
el
.
substr
(
1
))
:
target
.
el
;
var
children
=
el
.
children
;
return
children
.
length
-
1
===
target
.
index
;
}
function
getRect
(
el
)
{
var
rect
=
el
.
getBoundingClientRect
();
var
width
=
rect
.
right
-
rect
.
left
;
...
...
@@ -88,6 +95,10 @@
options
.
ontap
&&
options
.
ontap
();
window
.
SIMULATE_DRAG_ACTIVE
=
1
;
if
(
isLast
(
options
.
to
))
{
toRect
.
cy
+=
100
;
}
var
dragInterval
=
setInterval
(
function
loop
()
{
var
progress
=
(
new
Date
().
getTime
()
-
startTime
)
/
duration
;
var
x
=
(
fromRect
.
cx
+
(
toRect
.
cx
-
fromRect
.
cx
)
*
progress
)
-
scrollable
.
scrollLeft
;
...
...
spec/features/boards/issue_ordering_spec.rb
0 → 100644
浏览文件 @
b31f9102
require
'rails_helper'
describe
'Issue Boards'
,
:feature
,
:js
do
include
WaitForVueResource
include
DragTo
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:label
)
{
create
(
:label
,
project:
project
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
label
,
position:
0
)
}
let!
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label
])
}
let!
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label
])
}
let!
(
:issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label
])
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
end
context
'ordering in list'
do
before
do
visit
namespace_project_board_path
(
project
.
namespace
,
project
,
board
)
wait_for_vue_resource
expect
(
page
).
to
have_selector
(
'.board'
,
count:
2
)
end
it
'moves from middle to top'
do
drag
(
from_index:
1
,
to_index:
0
)
wait_for_vue_resource
expect
(
first
(
'.card'
)).
to
have_content
(
issue2
.
iid
)
end
it
'moves from middle to bottom'
do
drag
(
from_index:
1
,
to_index:
2
)
wait_for_vue_resource
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue2
.
iid
)
end
it
'moves from top to bottom'
do
drag
(
from_index:
0
,
to_index:
2
)
wait_for_vue_resource
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue3
.
iid
)
end
it
'moves from bottom to top'
do
drag
(
from_index:
2
,
to_index:
0
)
wait_for_vue_resource
expect
(
first
(
'.card'
)).
to
have_content
(
issue1
.
iid
)
end
it
'moves from top to middle'
do
drag
(
from_index:
0
,
to_index:
1
)
wait_for_vue_resource
expect
(
first
(
'.card'
)).
to
have_content
(
issue2
.
iid
)
end
it
'moves from bottom to middle'
do
drag
(
from_index:
2
,
to_index:
1
)
wait_for_vue_resource
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue2
.
iid
)
end
end
context
'ordering when changing list'
do
let
(
:label2
)
{
create
(
:label
,
project:
project
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
label2
,
position:
1
)
}
let!
(
:issue4
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label2
])
}
let!
(
:issue5
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label2
])
}
let!
(
:issue6
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label2
])
}
before
do
visit
namespace_project_board_path
(
project
.
namespace
,
project
,
board
)
wait_for_vue_resource
expect
(
page
).
to
have_selector
(
'.board'
,
count:
3
)
end
it
'moves to top of another list'
do
drag
(
list_from_index:
0
,
list_to_index:
1
)
wait_for_vue_resource
expect
(
first
(
'.board'
)).
to
have_selector
(
'.card'
,
count:
2
)
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
4
)
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
first
(
'.card'
)).
to
have_content
(
issue3
.
iid
)
end
end
it
'moves to bottom of another list'
do
drag
(
list_from_index:
0
,
list_to_index:
1
,
to_index:
2
)
wait_for_vue_resource
expect
(
first
(
'.board'
)).
to
have_selector
(
'.card'
,
count:
2
)
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
4
)
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue3
.
iid
)
end
end
it
'moves to index of another list'
do
drag
(
list_from_index:
0
,
list_to_index:
1
,
to_index:
1
)
wait_for_vue_resource
expect
(
first
(
'.board'
)).
to
have_selector
(
'.card'
,
count:
2
)
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
4
)
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
all
(
'.card'
)[
1
]).
to
have_content
(
issue3
.
iid
)
end
end
end
def
drag
(
selector:
'.board-list'
,
list_from_index:
0
,
from_index:
0
,
to_index:
0
,
list_to_index:
0
)
drag_to
(
selector:
selector
,
scrollable:
'#board-app'
,
list_from_index:
list_from_index
,
from_index:
from_index
,
to_index:
to_index
,
list_to_index:
list_to_index
)
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录