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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
365350df
Commit
365350df
authored
Oct 02, 2017
by
Simon Knox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests for label filters
parent
6ff83017
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
5 deletions
+101
-5
app/assets/javascripts/boards/boards_bundle.js
app/assets/javascripts/boards/boards_bundle.js
+11
-4
app/assets/javascripts/boards/components/board_form.vue
app/assets/javascripts/boards/components/board_form.vue
+1
-1
spec/ee/spec/features/boards/user_configures_board.rb
spec/ee/spec/features/boards/user_configures_board.rb
+89
-0
No files found.
app/assets/javascripts/boards/boards_bundle.js
View file @
365350df
...
...
@@ -96,13 +96,20 @@ $(() => {
updateFilterPath
(
'
weight
'
,
this
.
weight
,
'
weight
'
);
updateFilterPath
(
'
author_username
'
,
this
.
authorUsername
,
'
author
'
);
updateFilterPath
(
'
assignee_username
'
,
this
.
assigneeUsername
,
'
assignee
'
);
const
filterPath
=
gl
.
issueBoards
.
BoardsStore
.
filter
.
path
.
split
(
'
&
'
);
this
.
labels
.
forEach
((
label
)
=>
{
const
querystring
=
`label_id[]=
${
label
.
title
}
`
;
Store
.
filter
.
path
=
[
querystring
].
concat
(
Store
.
filter
.
path
.
split
(
'
&
'
).
filter
(
param
=>
param
.
match
(
new
RegExp
(
`^
${
querystring
}
$`
,
'
g
'
))
===
null
)
).
join
(
'
&
'
);
const
labelTitle
=
encodeURIComponent
(
label
.
title
);
const
param
=
`label_name[]=
${
labelTitle
}
`
;
const
labelIndex
=
filterPath
.
indexOf
(
param
);
if
(
labelIndex
===
-
1
)
{
filterPath
.
push
(
param
);
}
});
Store
.
filter
.
path
=
filterPath
.
join
(
'
&
'
);
Store
.
updateFiltersUrl
(
true
);
gl
.
boardService
=
new
BoardService
({
...
...
app/assets/javascripts/boards/components/board_form.vue
View file @
365350df
...
...
@@ -66,7 +66,7 @@
v-model=
"board.milestone_id"
title=
"Milestone"
defaultText=
"Any milestone"
:can
E
dit=
"canAdminBoard"
:can
-e
dit=
"canAdminBoard"
/>
</form-block>
...
...
spec/ee/spec/features/boards/user_configures_board.rb
View file @
365350df
...
...
@@ -11,6 +11,7 @@ describe 'issue board config', :js do
let!
(
:group_label
)
{
create
(
:group_label
,
group:
group
,
name:
'Group Label'
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:board
)
{
create
(
:board
,
project:
project
,
name:
'Project board'
)
}
let!
(
:group_board
)
{
create
(
:board
,
group:
group
,
name:
'Group board'
)
}
let!
(
:filtered_board
)
{
create
(
:board
,
project:
project_2
,
name:
'Filtered board'
,
milestone:
milestone
,
assignee:
user
,
weight:
2
)
}
let!
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let!
(
:issue_milestone
)
{
create
(
:closed_issue
,
project:
project
,
milestone:
milestone
)
}
...
...
@@ -145,6 +146,53 @@ describe 'issue board config', :js do
end
context
'labels'
do
let!
(
:label_1
)
{
create
(
:label
,
project:
project
,
name:
'Label 1'
)
}
let!
(
:label_2
)
{
create
(
:label
,
project:
project
,
name:
'Label 2'
)
}
let!
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label_1
])
}
let!
(
:issue_2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label_2
])
}
let!
(
:issue_3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
label_1
,
label_2
])
}
it
'adds label to board'
do
label_title
=
issue
.
labels
.
first
.
title
visit
project_boards_path
(
project
)
update_board_label
(
label_title
)
expect
(
page
).
to
have_css
(
'.js-visual-token'
)
expect
(
find
(
'.tokens-container'
)).
to
have_content
(
label_title
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
2
)
end
it
'adds multiple labels to board'
do
label_title
=
issue
.
labels
.
first
.
title
label_2_title
=
issue_2
.
labels
.
first
.
title
visit
project_boards_path
(
project
)
update_board_label
(
label_title
)
update_board_label
(
label_2_title
)
expect
(
page
).
to
have_css
(
'.js-visual-token'
)
expect
(
find
(
'.tokens-container'
)).
to
have_content
(
label_title
)
expect
(
find
(
'.tokens-container'
)).
to
have_content
(
label_2_title
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
1
)
end
it
'can filter by additional labels'
do
label_title
=
issue
.
labels
.
first
.
title
label_2_title
=
issue_2
.
labels
.
first
.
title
visit
project_boards_path
(
project
)
update_board_label
(
label_title
)
input_filtered_search
(
"label:~
#{
label_2_title
}
"
)
expect
(
page
).
to
have_selector
(
'.card'
,
count:
0
)
end
context
'group board'
do
it
'only shows group labels in list'
do
visit
group_boards_path
(
group
)
...
...
@@ -189,6 +237,9 @@ describe 'issue board config', :js do
end
end
# context 'author' do
# end
context
'weight'
do
let!
(
:issue_weight_1
)
{
create
(
:issue
,
project:
project
,
weight:
1
)
}
...
...
@@ -205,6 +256,13 @@ describe 'issue board config', :js do
expect
(
page
).
to
have_selector
(
'.card'
,
count:
4
)
end
# it 'sets board to No weight' do
# TODO
# update_board_weight('No weight')
# expect(page).to have_selector('.card', count: 3)
# end
it
'does not display weight in search hint'
do
update_board_weight
(
1
)
filtered_search
.
click
...
...
@@ -216,6 +274,33 @@ describe 'issue board config', :js do
end
end
end
context
'add issue'
do
it
'adds assignee'
do
visit
boards_path
(
filtered_board
)
end
end
context
'remove issue'
do
let!
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
project_label
],
milestone:
milestone
,
assignees:
[
user
])
}
let!
(
:list
)
{
create
(
:list
,
board:
board
,
label:
project_label
,
position:
0
)
}
it
'removes issues milestone when removing from the board'
do
visit
project_boards_path
(
project
)
wait_for_requests
find
(
".card[data-issue-id='
#{
issue
.
id
}
']"
).
click
click_button
'Remove from board'
wait_for_requests
expect
(
issue
.
reload
.
milestone
).
to
be_nil
expect
(
issue
.
reload
.
assignees
).
to
be_empty
end
end
end
context
'user without edit permissions'
do
...
...
@@ -271,6 +356,10 @@ describe 'issue board config', :js do
update_board_scope
(
'milestone'
,
milestone_title
)
end
def
update_board_label
(
label_title
)
update_board_scope
(
'labels'
,
label_title
)
end
def
update_board_assignee
(
assignee_name
)
update_board_scope
(
'assignee'
,
assignee_name
)
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