Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
034397d3
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,发现更多精彩内容 >>
提交
034397d3
编写于
2月 17, 2017
作者:
P
Phil Hughes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
This should make the ordering feature specs more reliable
上级
3ab101cc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
27 deletion
+39
-27
app/assets/javascripts/test_utils/simulate_drag.js
app/assets/javascripts/test_utils/simulate_drag.js
+24
-12
spec/features/boards/issue_ordering_spec.rb
spec/features/boards/issue_ordering_spec.rb
+15
-15
未找到文件。
app/assets/javascripts/test_utils/simulate_drag.js
浏览文件 @
034397d3
...
...
@@ -43,7 +43,14 @@
return
event
;
}
function
getTraget
(
target
)
{
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
getTarget
(
target
)
{
var
el
=
typeof
target
.
el
===
'
string
'
?
document
.
getElementById
(
target
.
el
.
substr
(
1
))
:
target
.
el
;
var
children
=
el
.
children
;
...
...
@@ -55,13 +62,6 @@
);
}
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
;
...
...
@@ -82,12 +82,22 @@
function
simulateDrag
(
options
,
callback
)
{
options
.
to
.
el
=
options
.
to
.
el
||
options
.
from
.
el
;
var
fromEl
=
getTraget
(
options
.
from
);
var
toEl
=
getTraget
(
options
.
to
);
var
fromEl
=
getTarget
(
options
.
from
);
var
toEl
=
getTarget
(
options
.
to
);
var
firstEl
=
getTarget
({
el
:
options
.
to
.
el
,
index
:
'
first
'
});
var
lastEl
=
getTarget
({
el
:
options
.
to
.
el
,
index
:
'
last
'
});
var
scrollable
=
options
.
scrollable
;
var
fromRect
=
getRect
(
fromEl
);
var
toRect
=
getRect
(
toEl
);
var
firstRect
=
getRect
(
firstEl
);
var
lastRect
=
getRect
(
lastEl
);
var
startTime
=
new
Date
().
getTime
();
var
duration
=
options
.
duration
||
1000
;
...
...
@@ -95,8 +105,10 @@
options
.
ontap
&&
options
.
ontap
();
window
.
SIMULATE_DRAG_ACTIVE
=
1
;
if
(
isLast
(
options
.
to
))
{
toRect
.
cy
+=
100
;
if
(
options
.
to
.
index
===
0
)
{
toRect
.
cy
=
firstRect
.
y
;
}
else
if
(
isLast
(
options
.
to
))
{
toRect
.
cy
=
lastRect
.
y
+
lastRect
.
h
+
50
;
}
var
dragInterval
=
setInterval
(
function
loop
()
{
...
...
spec/features/boards/issue_ordering_spec.rb
浏览文件 @
034397d3
...
...
@@ -9,9 +9,9 @@ describe 'Issue Boards', :feature, :js do
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
]
)
}
let!
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
title:
'testing 1'
,
labels:
[
label
],
relative_position:
3.0
)
}
let!
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
title:
'testing 2'
,
labels:
[
label
],
relative_position:
2.0
)
}
let!
(
:issue3
)
{
create
(
:labeled_issue
,
project:
project
,
title:
'testing 3'
,
labels:
[
label
],
relative_position:
1.0
)
}
before
do
project
.
team
<<
[
user
,
:master
]
...
...
@@ -32,7 +32,7 @@ describe 'Issue Boards', :feature, :js do
wait_for_vue_resource
expect
(
first
(
'.card'
)).
to
have_content
(
issue2
.
iid
)
expect
(
first
(
'.card'
)).
to
have_content
(
issue2
.
title
)
end
it
'moves from middle to bottom'
do
...
...
@@ -40,7 +40,7 @@ describe 'Issue Boards', :feature, :js do
wait_for_vue_resource
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue2
.
iid
)
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue2
.
title
)
end
it
'moves from top to bottom'
do
...
...
@@ -48,7 +48,7 @@ describe 'Issue Boards', :feature, :js do
wait_for_vue_resource
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue3
.
iid
)
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue3
.
title
)
end
it
'moves from bottom to top'
do
...
...
@@ -56,7 +56,7 @@ describe 'Issue Boards', :feature, :js do
wait_for_vue_resource
expect
(
first
(
'.card'
)).
to
have_content
(
issue1
.
iid
)
expect
(
first
(
'.card'
)).
to
have_content
(
issue1
.
title
)
end
it
'moves from top to middle'
do
...
...
@@ -64,7 +64,7 @@ describe 'Issue Boards', :feature, :js do
wait_for_vue_resource
expect
(
first
(
'.card'
)).
to
have_content
(
issue2
.
iid
)
expect
(
first
(
'.card'
)).
to
have_content
(
issue2
.
title
)
end
it
'moves from bottom to middle'
do
...
...
@@ -72,16 +72,16 @@ describe 'Issue Boards', :feature, :js do
wait_for_vue_resource
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue2
.
iid
)
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue2
.
title
)
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
]
)
}
let!
(
:issue4
)
{
create
(
:labeled_issue
,
project:
project
,
title:
'testing 1'
,
labels:
[
label2
],
relative_position:
3.0
)
}
let!
(
:issue5
)
{
create
(
:labeled_issue
,
project:
project
,
title:
'testing 2'
,
labels:
[
label2
],
relative_position:
2.0
)
}
let!
(
:issue6
)
{
create
(
:labeled_issue
,
project:
project
,
title:
'testing 3'
,
labels:
[
label2
],
relative_position:
1.0
)
}
before
do
visit
namespace_project_board_path
(
project
.
namespace
,
project
,
board
)
...
...
@@ -99,7 +99,7 @@ describe 'Issue Boards', :feature, :js do
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
4
)
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
first
(
'.card'
)).
to
have_content
(
issue3
.
iid
)
expect
(
first
(
'.card'
)).
to
have_content
(
issue3
.
title
)
end
end
...
...
@@ -112,7 +112,7 @@ describe 'Issue Boards', :feature, :js do
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
)
expect
(
all
(
'.card'
).
last
).
to
have_content
(
issue3
.
title
)
end
end
...
...
@@ -125,7 +125,7 @@ describe 'Issue Boards', :feature, :js do
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
)
expect
(
all
(
'.card'
)[
1
]).
to
have_content
(
issue3
.
title
)
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录