BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
034397d3
Commit
034397d3
authored
Feb 17, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This should make the ordering feature specs more reliable
parent
3ab101cc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
27 deletions
+39
-27
simulate_drag.js
app/assets/javascripts/test_utils/simulate_drag.js
+24
-12
issue_ordering_spec.rb
spec/features/boards/issue_ordering_spec.rb
+15
-15
No files found.
app/assets/javascripts/test_utils/simulate_drag.js
View file @
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
View file @
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
...
...
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