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
9a579e82
Commit
9a579e82
authored
Aug 10, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added filter tests
parent
7937321b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
148 additions
and
8 deletions
+148
-8
app/assets/javascripts/boards/models/issue.js.es6
app/assets/javascripts/boards/models/issue.js.es6
+2
-2
app/views/projects/boards/components/_card.html.haml
app/views/projects/boards/components/_card.html.haml
+1
-1
spec/features/boards/boards_spec.rb
spec/features/boards/boards_spec.rb
+145
-5
No files found.
app/assets/javascripts/boards/models/issue.js.es6
View file @
9a579e82
...
@@ -9,11 +9,11 @@ class Issue {
...
@@ -9,11 +9,11 @@ class Issue {
this.labels = [];
this.labels = [];
obj.labels.forEach(
(label) => {
_.each(obj.labels,
(label) => {
this.labels.push(new Label(label));
this.labels.push(new Label(label));
});
});
this.priority =
this.labels.reduce(
(max, label) => {
this.priority =
_.reduce(this.labels,
(max, label) => {
return (label.priority < max) ? label.priority : max;
return (label.priority < max) ? label.priority : max;
}, Infinity);
}, Infinity);
}
}
...
...
app/views/projects/boards/components/_card.html.haml
View file @
9a579e82
%board-card
{
"inline-template"
=>
true
,
%board-card
{
"inline-template"
=>
true
,
"v-for"
=>
"issue in issues | orderBy
['priority', 'id']
"
,
"v-for"
=>
"issue in issues | orderBy
'priority'
"
,
":issue"
=>
"issue"
,
":issue"
=>
"issue"
,
":issue-link-base"
=>
"issueLinkBase"
,
":issue-link-base"
=>
"issueLinkBase"
,
":disabled"
=>
"disabled"
,
":disabled"
=>
"disabled"
,
...
...
spec/features/boards/boards_spec.rb
View file @
9a579e82
...
@@ -3,10 +3,12 @@ require 'rails_helper'
...
@@ -3,10 +3,12 @@ require 'rails_helper'
describe
'Issue Boards'
,
feature:
true
,
js:
true
do
describe
'Issue Boards'
,
feature:
true
,
js:
true
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:user2
)
{
create
(
:user
)
}
let!
(
:board
)
{
Boards
::
CreateService
.
new
(
project
,
user
).
execute
}
let!
(
:board
)
{
Boards
::
CreateService
.
new
(
project
,
user
).
execute
}
before
do
before
do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:master
]
login_as
(
user
)
login_as
(
user
)
end
end
...
@@ -42,22 +44,25 @@ describe 'Issue Boards', feature: true, js: true do
...
@@ -42,22 +44,25 @@ describe 'Issue Boards', feature: true, js: true do
end
end
context
'with lists'
do
context
'with lists'
do
let
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let
(
:planning
)
{
create
(
:label
,
project:
project
,
name:
'Planning'
)
}
let
(
:planning
)
{
create
(
:label
,
project:
project
,
name:
'Planning'
)
}
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:testing
)
{
create
(
:label
,
project:
project
,
name:
'Testing'
)
}
let
(
:testing
)
{
create
(
:label
,
project:
project
,
name:
'Testing'
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
name:
'Bug'
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
project
.
board
,
label:
planning
,
position:
0
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
project
.
board
,
label:
planning
,
position:
0
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
project
.
board
,
label:
development
,
position:
1
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
project
.
board
,
label:
development
,
position:
1
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
,
assignee:
user
)
}
let!
(
:issue1
)
{
create
(
:issue
,
project:
project
,
assignee:
user
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue2
)
{
create
(
:issue
,
project:
project
,
author:
user2
)
}
let!
(
:issue3
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue3
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue4
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue4
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue5
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
])
}
let!
(
:issue5
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
]
,
milestone:
milestone
)
}
let!
(
:issue6
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
,
development
])
}
let!
(
:issue6
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
,
development
])
}
let!
(
:issue7
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
])
}
let!
(
:issue7
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
])
}
let!
(
:issue8
)
{
create
(
:closed_issue
,
project:
project
)
}
let!
(
:issue8
)
{
create
(
:closed_issue
,
project:
project
)
}
let!
(
:issue9
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
testing
])
}
let!
(
:issue9
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
testing
,
bug
])
}
before
do
before
do
visit
namespace_project_board_path
(
project
.
namespace
,
project
)
visit
namespace_project_board_path
(
project
.
namespace
,
project
)
...
@@ -159,6 +164,13 @@ describe 'Issue Boards', feature: true, js: true do
...
@@ -159,6 +164,13 @@ describe 'Issue Boards', feature: true, js: true do
end
end
context
'lists'
do
context
'lists'
do
it
'changes position of list'
do
drag_to
(
list_from_index:
1
,
list_to_index:
2
,
selector:
'.js-board-handle'
)
expect
(
all
(
'.board'
)[
1
]).
to
have_content
(
development
.
title
)
expect
(
all
(
'.board'
)[
1
]).
to
have_content
(
planning
.
title
)
end
it
'moves between lists'
do
it
'moves between lists'
do
drag_to
(
list_from_index:
1
,
card_index:
1
,
list_to_index:
2
)
drag_to
(
list_from_index:
1
,
card_index:
1
,
list_to_index:
2
)
...
@@ -235,12 +247,140 @@ describe 'Issue Boards', feature: true, js: true do
...
@@ -235,12 +247,140 @@ describe 'Issue Boards', feature: true, js: true do
end
end
context
'filtering'
do
context
'filtering'
do
it
'filters by author'
do
page
.
within
'.issues-filters'
do
click_button
(
'Author'
)
page
.
within
'.dropdown-menu-author'
do
click_link
(
user2
.
name
)
end
expect
(
find
(
'.js-author-search'
)).
to
have_content
(
user2
.
name
)
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'1'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'0'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
0
)
end
end
it
'filters by assignee'
do
page
.
within
'.issues-filters'
do
click_button
(
'Assignee'
)
page
.
within
'.dropdown-menu-assignee'
do
click_link
(
user
.
name
)
end
expect
(
find
(
'.js-assignee-search'
)).
to
have_content
(
user
.
name
)
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'1'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'0'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
0
)
end
end
it
'filters by milestone'
do
page
.
within
'.issues-filters'
do
click_button
(
'Milestone'
)
page
.
within
'.milestone-filter'
do
click_link
(
milestone
.
title
)
end
expect
(
find
(
'.js-milestone-select'
)).
to
have_content
(
milestone
.
title
)
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'0'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
0
)
end
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'1'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
end
it
'filters by label'
do
page
.
within
'.issues-filters'
do
click_button
(
'Label'
)
page
.
within
'.dropdown-menu-labels'
do
click_link
(
testing
.
title
)
find
(
'.dropdown-menu-close'
).
click
end
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'1'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'0'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
0
)
end
end
it
'filters by multiple labels'
do
page
.
within
'.issues-filters'
do
click_button
(
'Label'
)
page
.
within
'.dropdown-menu-labels'
do
click_link
(
testing
.
title
)
click_link
(
bug
.
title
)
find
(
'.dropdown-menu-close'
).
click
end
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'2'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
end
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'0'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
0
)
end
end
it
'filters by no label'
do
page
.
within
'.issues-filters'
do
click_button
(
'Label'
)
page
.
within
'.dropdown-menu-labels'
do
click_link
(
"No Label"
)
find
(
'.dropdown-menu-close'
).
click
end
end
page
.
within
(
first
(
'.board'
))
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'4'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
4
)
end
page
.
within
(
all
(
'.board'
)[
1
])
do
expect
(
page
.
find
(
'.board-header'
)).
to
have_content
(
'0'
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
0
)
end
end
end
end
end
end
def
drag_to
(
list_from_index:
0
,
card_index:
0
,
to_index:
0
,
list_to_index:
0
)
def
drag_to
(
list_from_index:
0
,
card_index:
0
,
to_index:
0
,
list_to_index:
0
,
selector:
'.board-list'
)
evaluate_script
(
"simulateDrag({scrollable: document.getElementById('board-app'), from: {el: $('
.board-list
').eq(
#{
list_from_index
}
).get(0), index:
#{
card_index
}
}, to: {el: $('.board-list').eq(
#{
list_to_index
}
).get(0), index:
#{
to_index
}
}});"
)
evaluate_script
(
"simulateDrag({scrollable: document.getElementById('board-app'), from: {el: $('
#{
selector
}
').eq(
#{
list_from_index
}
).get(0), index:
#{
card_index
}
}, to: {el: $('.board-list').eq(
#{
list_to_index
}
).get(0), index:
#{
to_index
}
}});"
)
sleep
1
sleep
1
end
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