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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
0ee548d3
Commit
0ee548d3
authored
Aug 09, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some tests
parent
71605f31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
211 additions
and
35 deletions
+211
-35
app/assets/javascripts/boards/test_utils/simulate_drag.js
app/assets/javascripts/boards/test_utils/simulate_drag.js
+1
-0
app/views/projects/boards/show.html.haml
app/views/projects/boards/show.html.haml
+1
-1
spec/features/boards/boards_spec.rb
spec/features/boards/boards_spec.rb
+209
-34
No files found.
app/assets/javascripts/boards/test_utils/simulate_drag.js
View file @
0ee548d3
...
...
@@ -3,6 +3,7 @@
function
simulateEvent
(
el
,
type
,
options
)
{
var
event
;
if
(
!
el
)
return
;
var
ownerDocument
=
el
.
ownerDocument
;
options
=
options
||
{};
...
...
app/views/projects/boards/show.html.haml
View file @
0ee548d3
...
...
@@ -4,7 +4,7 @@
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_tag
(
'boards/boards_bundle.js'
)
=
page_specific_javascript_tag
(
'boards/test_utils/simulate_drag.js'
)
if
Rails
.
env
.
test?
=
page_specific_javascript_tag
(
'boards/test_utils/simulate_drag.js'
)
=
render
"projects/issues/head"
...
...
spec/features/boards/boards_spec.rb
View file @
0ee548d3
...
...
@@ -3,64 +3,239 @@ require 'rails_helper'
describe
'Issue Boards'
,
feature:
true
,
js:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:board
)
{
Boards
::
CreateService
.
new
(
project
,
user
).
execute
}
before
do
project
.
team
<<
[
user
,
:master
]
login_as
(
user
)
visit
namespace_project_board_path
(
project
.
namespace
,
project
)
end
it
'shows default lists'
do
lists
=
all
(
'.board'
)
context
'no lists'
do
before
do
visit
namespace_project_board_path
(
project
.
namespace
,
project
)
end
page
.
within
lists
.
first
do
expect
(
page
).
to
have_content
'Backlog'
it
'shows blank state'
do
expect
(
page
).
to
have_selector
(
'.board'
,
count:
3
)
expect
(
page
).
to
have_content
(
'Welcome to your Issue Board!'
)
end
page
.
within
lists
.
last
do
expect
(
page
).
to
have_content
'Done'
it
'hides the blank state when clicking nermind button'
do
page
.
within
(
'.board-blank-state'
)
do
click_button
(
'Nevermind, I\'ll use my own'
)
end
expect
(
page
).
to
have_selector
(
'.board'
,
count:
2
)
end
end
it
'removes blank state list
'
do
click_button
'Nevermind, i\'ll use my own'
it
'creates default lists
'
do
lists
=
[
'Backlog'
,
'Development'
,
'Testing'
,
'Production'
,
'Ready'
,
'Done'
]
expect
(
page
).
to
have_selector
(
'.board'
,
count:
2
)
page
.
within
(
'.board-blank-state'
)
do
click_button
(
'Add default lists'
)
end
expect
(
page
).
to
have_selector
(
'.board'
,
count:
6
)
page
.
all
(
'.board'
).
each_with_index
do
|
list
,
i
|
expect
(
list
.
find
(
'.board-title'
)).
to
have_content
(
lists
[
i
])
end
end
end
it
'can drag card to new list'
do
sleep
0.5
lists
=
all
(
'.board'
)
drag_to
(
list_from_index:
0
,
list_to_index:
1
)
context
'with lists'
do
let
(
:planning
)
{
create
(
:label
,
project:
project
,
name:
'Planning'
)
}
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:testing
)
{
create
(
:label
,
project:
project
,
name:
'Testing'
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
project
.
board
,
label:
planning
,
position:
0
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
project
.
board
,
label:
development
,
position:
1
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
,
assignee:
user
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue3
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue4
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue5
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
])
}
let!
(
:issue6
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
,
development
])
}
let!
(
:issue7
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
])
}
let!
(
:issue8
)
{
create
(
:closed_issue
,
project:
project
)
}
let!
(
:issue9
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
testing
])
}
before
do
visit
namespace_project_board_path
(
project
.
namespace
,
project
)
sleep
1
end
it
'shows lists'
do
expect
(
page
).
to
have_selector
(
'.board'
,
count:
4
)
end
it
'shows issues in lists'
do
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'2'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
end
page
.
within
lists
[
1
].
find
(
'.board-list'
)
do
expect
(
page
).
to
have_content
(
'Test'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
page
.
within
(
all
(
'.board'
)[
2
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'2'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
end
end
page
.
within
first
(
'.card .card-footer'
)
do
expect
(
page
).
to
have_content
'Frontend'
it
'allows user to delete board'
do
page
.
within
(
all
(
'.board'
)[
1
])
do
find
(
'.board-delete'
).
click
end
expect
(
page
).
to
have_selector
(
'.board'
,
count:
3
)
end
end
it
'removes all labels from card'
do
sleep
0.5
lists
=
all
(
'.board'
)
drag_to
(
list_from_index:
1
,
list_to_index:
3
)
context
'backlog'
do
it
'shows issues in backlog with no labels'
do
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'5'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
5
)
end
end
it
'is searchable'
do
page
.
within
(
first
(
'.board'
))
do
find
(
'.form-control'
).
set
issue1
.
title
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
end
it
'clears search'
do
page
.
within
(
first
(
'.board'
))
do
find
(
'.form-control'
).
set
issue1
.
title
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
find
(
'.board-search-clear-btn'
).
click
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
end
end
it
'moves issue from backlog into list'
do
drag_to
(
list_to_index:
1
)
page
.
within
lists
[
3
].
find
(
'.board-list'
)
do
expect
(
page
).
to
have_content
(
'Frontend bug'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'3'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
3
)
end
page
.
within
first
(
'.card .card-footer'
)
do
expect
(
page
).
not_to
have_content
'Frontend'
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'3'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
3
)
all
(
'.card'
).
each
do
|
card
|
expect
(
card
.
all
(
'.label'
).
last
).
to
have_content
(
planning
.
title
)
end
end
end
end
page
.
within
lists
[
1
].
find
(
'.board-list'
)
do
expect
(
page
).
not_to
have_content
(
'Frontend bug'
)
expect
(
page
).
not_to
have_selector
(
'.card'
)
context
'done'
do
it
'shows list of done issues'
do
expect
(
all
(
'.board'
).
last
).
to
have_selector
(
'.card'
,
count:
1
)
end
it
'moves issue to done'
do
drag_to
(
list_from_index:
0
,
list_to_index:
3
)
expect
(
all
(
'.board'
).
last
).
to
have_selector
(
'.card'
,
count:
2
)
expect
(
all
(
'.board'
).
last
).
to
have_content
(
issue4
.
title
)
expect
(
all
(
'.board'
).
last
).
not_to
have_content
(
planning
.
title
)
end
it
'removes all of the same issue to done'
do
drag_to
(
list_from_index:
1
,
list_to_index:
3
)
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
1
)
expect
(
all
(
'.board'
)[
2
]).
to
have_selector
(
'.card'
,
count:
1
)
expect
(
all
(
'.board'
).
last
).
to
have_content
(
issue6
.
title
)
expect
(
all
(
'.board'
).
last
).
not_to
have_content
(
planning
.
title
)
end
end
context
'lists'
do
it
'moves between lists'
do
drag_to
(
list_from_index:
1
,
card_index:
1
,
list_to_index:
2
)
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
1
)
expect
(
all
(
'.board'
)[
2
]).
to
have_selector
(
'.card'
,
count:
3
)
expect
(
all
(
'.board'
)[
2
]).
to
have_content
(
issue5
.
title
)
expect
(
all
(
'.board'
)[
2
].
all
(
'.card'
).
last
).
to
have_content
(
development
.
title
)
end
it
'moves between lists'
do
drag_to
(
list_from_index:
2
,
list_to_index:
1
)
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
3
)
expect
(
all
(
'.board'
)[
2
]).
to
have_selector
(
'.card'
,
count:
1
)
expect
(
all
(
'.board'
)[
1
]).
to
have_content
(
issue7
.
title
)
expect
(
all
(
'.board'
)[
1
].
all
(
'.card'
).
first
).
to
have_content
(
planning
.
title
)
end
it
'moves from done'
do
drag_to
(
list_from_index:
3
,
list_to_index:
1
)
expect
(
all
(
'.board'
)[
1
]).
to
have_selector
(
'.card'
,
count:
3
)
expect
(
all
(
'.board'
)[
1
]).
to
have_content
(
issue8
.
title
)
expect
(
all
(
'.board'
)[
1
].
all
(
'.card'
).
first
).
to
have_content
(
planning
.
title
)
end
context
'issue card'
do
it
'shows assignee'
do
page
.
within
(
first
(
'.board'
))
do
expect
(
all
(
'.card'
).
last
).
to
have_selector
(
'.avatar'
)
end
end
end
context
'new list'
do
it
'shows all labels in new list dropdown'
do
click_button
'Create new list'
page
.
within
(
'.dropdown-menu-issues-board-new'
)
do
expect
(
page
).
to
have_content
(
planning
.
title
)
expect
(
page
).
to
have_content
(
development
.
title
)
expect
(
page
).
to
have_content
(
testing
.
title
)
end
end
it
'creates new list for label'
do
click_button
'Create new list'
page
.
within
(
'.dropdown-menu-issues-board-new'
)
do
click_link
testing
.
title
end
expect
(
page
).
to
have_selector
(
'.board'
,
count:
5
)
end
it
'moves issues from backlog into new list'
do
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'5'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
5
)
end
click_button
'Create new list'
page
.
within
(
'.dropdown-menu-issues-board-new'
)
do
click_link
testing
.
title
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'4'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
4
)
end
end
end
end
context
'filtering'
do
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