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
24c81b28
Commit
24c81b28
authored
Aug 01, 2020
by
Scott Stern
Committed by
Paul Slaughter
Aug 01, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix board settings sidebar FOSS specs
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/38363
parent
cbf53224
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
170 additions
and
129 deletions
+170
-129
app/assets/javascripts/boards/components/board_settings_sidebar.vue
.../javascripts/boards/components/board_settings_sidebar.vue
+16
-50
ee/app/assets/javascripts/boards/components/board_settings_list_types.vue
...vascripts/boards/components/board_settings_list_types.vue
+71
-0
ee/spec/frontend/boards/components/board_setting_list_types_spec.js
...ontend/boards/components/board_setting_list_types_spec.js
+64
-0
ee/spec/frontend/boards/components/board_settings_sidebar_spec.js
...frontend/boards/components/board_settings_sidebar_spec.js
+18
-0
spec/frontend/boards/components/board_settings_sidebar_spec.js
...frontend/boards/components/board_settings_sidebar_spec.js
+1
-79
No files found.
app/assets/javascripts/boards/components/board_settings_sidebar.vue
View file @
24c81b28
<
script
>
<
script
>
import
{
GlDrawer
,
GlLabel
,
GlAvatarLink
,
GlAvatarLabeled
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
GlDrawer
,
GlLabel
}
from
'
@gitlab/ui
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
mapActions
,
mapState
}
from
'
vuex
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
...
@@ -15,16 +15,13 @@ export default {
...
@@ -15,16 +15,13 @@ export default {
milestone
:
'
milestone
'
,
milestone
:
'
milestone
'
,
label
:
'
label
'
,
label
:
'
label
'
,
labelListText
:
__
(
'
Label
'
),
labelListText
:
__
(
'
Label
'
),
labelMilestoneText
:
__
(
'
Milestone
'
),
labelAssigneeText
:
__
(
'
Assignee
'
),
components
:
{
components
:
{
GlDrawer
,
GlDrawer
,
GlLabel
,
GlLabel
,
GlAvatarLink
,
GlAvatarLabeled
,
GlLink
,
BoardSettingsSidebarWipLimit
:
()
=>
BoardSettingsSidebarWipLimit
:
()
=>
import
(
'
ee_component/boards/components/board_settings_wip_limit.vue
'
),
import
(
'
ee_component/boards/components/board_settings_wip_limit.vue
'
),
BoardSettingsListTypes
:
()
=>
import
(
'
ee_component/boards/components/board_settings_list_types.vue
'
),
},
},
computed
:
{
computed
:
{
...
mapState
([
'
activeId
'
]),
...
mapState
([
'
activeId
'
]),
...
@@ -41,30 +38,11 @@ export default {
...
@@ -41,30 +38,11 @@ export default {
activeListLabel
()
{
activeListLabel
()
{
return
this
.
activeList
.
label
;
return
this
.
activeList
.
label
;
},
},
activeListMilestone
()
{
return
this
.
activeList
.
milestone
;
},
activeListAssignee
()
{
return
this
.
activeList
.
assignee
;
},
boardListType
()
{
boardListType
()
{
return
this
.
activeList
.
type
||
null
;
return
this
.
activeList
.
type
||
null
;
},
},
listTypeTitle
()
{
listTypeTitle
()
{
switch
(
this
.
boardListType
)
{
return
this
.
$options
.
labelListText
;
case
this
.
$options
.
milestone
:
{
return
this
.
$options
.
labelMilestoneText
;
}
case
this
.
$options
.
label
:
{
return
this
.
$options
.
labelListText
;
}
case
this
.
$options
.
assignee
:
{
return
this
.
$options
.
labelAssigneeText
;
}
default
:
{
return
''
;
}
}
},
},
},
},
created
()
{
created
()
{
...
@@ -94,32 +72,20 @@ export default {
...
@@ -94,32 +72,20 @@ export default {
>
>
<template
#header
>
{{
$options
.
listSettingsText
}}
</
template
>
<template
#header
>
{{
$options
.
listSettingsText
}}
</
template
>
<
template
v-if=
"isSidebarOpen"
>
<
template
v-if=
"isSidebarOpen"
>
<div
class=
"d-flex flex-column align-items-start"
>
<div
v-if=
"boardListType === $options.label"
>
<label
class=
"js-list-label"
>
{{
listTypeTitle
}}
</label>
<label
class=
"js-list-label gl-display-block"
>
{{
listTypeTitle
}}
</label>
<template
v-if=
"boardListType === $options.label"
>
<gl-label
<gl-label
:title=
"activeListLabel.title"
:title=
"activeListLabel.title"
:background-color=
"activeListLabel.color"
:background-color=
"activeListLabel.color"
:scoped=
"showScopedLabels(activeListLabel)"
:scoped=
"showScopedLabels(activeListLabel)"
/>
/>
</
template
>
<
template
v-else-if=
"boardListType === $options.assignee"
>
<gl-avatar-link
class=
"js-assignee"
:href=
"activeListAssignee.webUrl"
>
<gl-avatar-labeled
:size=
"32"
:label=
"activeListAssignee.name"
:sub-label=
"`@$
{activeListAssignee.username}`"
:src="activeListAssignee.avatar"
/>
</gl-avatar-link>
</
template
>
<
template
v-else-if=
"boardListType === $options.milestone"
>
<gl-link
class=
"js-milestone"
:href=
"activeListMilestone.webUrl"
>
{{
activeListMilestone
.
title
}}
</gl-link>
</
template
>
</div>
</div>
<board-settings-list-types
v-else
:active-list=
"activeList"
:board-list-type=
"boardListType"
/>
<board-settings-sidebar-wip-limit
:max-issue-count=
"activeList.maxIssueCount"
/>
<board-settings-sidebar-wip-limit
:max-issue-count=
"activeList.maxIssueCount"
/>
</
template
>
</
template
>
</gl-drawer>
</gl-drawer>
...
...
ee/app/assets/javascripts/boards/components/board_settings_list_types.vue
0 → 100644
View file @
24c81b28
<
script
>
import
{
GlAvatarLink
,
GlAvatarLabeled
,
GlLink
}
from
'
@gitlab/ui
'
;
import
{
__
}
from
'
~/locale
'
;
export
default
{
milestone
:
'
milestone
'
,
assignee
:
'
assignee
'
,
labelMilestoneText
:
__
(
'
Milestone
'
),
labelAssigneeText
:
__
(
'
Assignee
'
),
components
:
{
GlLink
,
GlAvatarLink
,
GlAvatarLabeled
,
},
props
:
{
boardListType
:
{
type
:
String
,
required
:
true
,
},
activeList
:
{
type
:
Object
,
required
:
true
,
},
},
computed
:
{
activeListAssignee
()
{
return
this
.
activeList
.
assignee
;
},
activeListMilestone
()
{
return
this
.
activeList
.
milestone
;
},
listTypeTitle
()
{
switch
(
this
.
boardListType
)
{
case
this
.
$options
.
milestone
:
{
return
this
.
$options
.
labelMilestoneText
;
}
case
this
.
$options
.
assignee
:
{
return
this
.
$options
.
labelAssigneeText
;
}
default
:
{
return
''
;
}
}
},
},
};
</
script
>
<
template
>
<div>
<label
class=
"js-list-label gl-display-block"
>
{{
listTypeTitle
}}
</label>
<gl-link
v-if=
"boardListType === $options.milestone"
class=
"js-milestone"
:href=
"activeListMilestone.webUrl"
>
{{
activeListMilestone
.
title
}}
</gl-link
>
<gl-avatar-link
v-else-if=
"boardListType === $options.assignee"
class=
"js-assignee"
:href=
"activeListAssignee.webUrl"
>
<gl-avatar-labeled
:size=
"32"
:label=
"activeListAssignee.name"
:sub-label=
"`@$
{activeListAssignee.username}`"
:src="activeListAssignee.avatar"
/>
</gl-avatar-link>
</div>
</
template
>
ee/spec/frontend/boards/components/board_setting_list_types_spec.js
0 → 100644
View file @
24c81b28
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
GlAvatarLink
,
GlAvatarLabeled
}
from
'
@gitlab/ui
'
;
import
BoardSettingsListTypes
from
'
ee_component/boards/components/board_settings_list_types.vue
'
;
describe
(
'
BoardSettingsListType
'
,
()
=>
{
let
wrapper
;
const
activeList
=
{
milestone
:
{
webUrl
:
'
https://gitlab.com/h5bp/html5-boilerplate/-/milestones/1
'
,
title
:
'
Backlog
'
,
},
assignee
:
{
webUrl
:
'
https://gitlab.com/root
'
,
name
:
'
root
'
,
username
:
'
root
'
},
};
const
createComponent
=
props
=>
{
wrapper
=
shallowMount
(
BoardSettingsListTypes
,
{
propsData
:
{
...
props
,
activeList
},
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
});
describe
(
'
when list type is "milestone"
'
,
()
=>
{
it
(
'
renders the correct milestone text
'
,
()
=>
{
createComponent
({
activeId
:
1
,
boardListType
:
'
milestone
'
});
expect
(
wrapper
.
find
(
'
.js-milestone
'
).
text
()).
toBe
(
'
Backlog
'
);
});
it
(
'
renders the correct list type text
'
,
()
=>
{
createComponent
({
activeId
:
1
,
boardListType
:
'
milestone
'
});
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toBe
(
'
Milestone
'
);
});
});
describe
(
'
when list type is "assignee"
'
,
()
=>
{
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
renders gl-avatar-link with correct href
'
,
()
=>
{
createComponent
({
activeId
:
1
,
boardListType
:
'
assignee
'
});
expect
(
wrapper
.
find
(
GlAvatarLink
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLink
).
attributes
(
'
href
'
)).
toBe
(
'
https://gitlab.com/root
'
);
});
it
(
'
renders gl-avatar-labeled with "root" as username and name as "root"
'
,
()
=>
{
createComponent
({
activeId
:
1
,
boardListType
:
'
assignee
'
});
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
attributes
(
'
label
'
)).
toBe
(
'
root
'
);
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
attributes
(
'
sublabel
'
)).
toBe
(
'
@root
'
);
});
it
(
'
renders the correct list type text
'
,
()
=>
{
createComponent
({
activeId
:
1
,
boardListType
:
'
assignee
'
});
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toBe
(
'
Assignee
'
);
});
});
});
ee/spec/frontend/boards/components/board_settings_sidebar_spec.js
View file @
24c81b28
...
@@ -5,6 +5,7 @@ import Vuex from 'vuex';
...
@@ -5,6 +5,7 @@ import Vuex from 'vuex';
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
BoardSettingsSidebar
from
'
~/boards/components/board_settings_sidebar.vue
'
;
import
BoardSettingsSidebar
from
'
~/boards/components/board_settings_sidebar.vue
'
;
import
BoardSettingsWipLimit
from
'
ee_component/boards/components/board_settings_wip_limit.vue
'
;
import
BoardSettingsWipLimit
from
'
ee_component/boards/components/board_settings_wip_limit.vue
'
;
import
BoardSettingsListTypes
from
'
ee_component/boards/components/board_settings_list_types.vue
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
...
@@ -33,6 +34,7 @@ describe('ee/BoardSettingsSidebar', () => {
...
@@ -33,6 +34,7 @@ describe('ee/BoardSettingsSidebar', () => {
localVue
,
localVue
,
stubs
:
{
stubs
:
{
'
board-settings-sidebar-wip-limit
'
:
BoardSettingsWipLimit
,
'
board-settings-sidebar-wip-limit
'
:
BoardSettingsWipLimit
,
'
board-settings-list-types
'
:
BoardSettingsListTypes
,
},
},
});
});
};
};
...
@@ -59,4 +61,20 @@ describe('ee/BoardSettingsSidebar', () => {
...
@@ -59,4 +61,20 @@ describe('ee/BoardSettingsSidebar', () => {
expect
(
wrapper
.
find
(
BoardSettingsWipLimit
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
BoardSettingsWipLimit
).
exists
()).
toBe
(
true
);
});
});
it
(
'
confirms we render BoardSettingsListTypes
'
,
()
=>
{
boardsStore
.
addList
({
id
:
1
,
milestone
:
{
webUrl
:
'
https://gitlab.com/h5bp/html5-boilerplate/-/milestones/1
'
,
title
:
'
Backlog
'
,
},
max_issue_count
:
1
,
list_type
:
'
milestone
'
,
});
createComponent
({
activeId
:
listId
});
expect
(
wrapper
.
find
(
BoardSettingsListTypes
).
exists
()).
toBe
(
true
);
});
});
});
spec/frontend/boards/components/board_settings_sidebar_spec.js
View file @
24c81b28
...
@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter';
...
@@ -3,7 +3,7 @@ import MockAdapter from 'axios-mock-adapter';
import
axios
from
'
axios
'
;
import
axios
from
'
axios
'
;
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
GlDrawer
,
GlLabel
,
GlAvatarLink
,
GlAvatarLabeled
}
from
'
@gitlab/ui
'
;
import
{
GlDrawer
,
GlLabel
}
from
'
@gitlab/ui
'
;
import
BoardSettingsSidebar
from
'
~/boards/components/board_settings_sidebar.vue
'
;
import
BoardSettingsSidebar
from
'
~/boards/components/board_settings_sidebar.vue
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
...
@@ -156,82 +156,4 @@ describe('BoardSettingsSidebar', () => {
...
@@ -156,82 +156,4 @@ describe('BoardSettingsSidebar', () => {
expect
(
findLabel
().
exists
()).
toBe
(
false
);
expect
(
findLabel
().
exists
()).
toBe
(
false
);
});
});
});
});
describe
(
'
when activeList is present
'
,
()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
});
afterEach
(()
=>
{
boardsStore
.
removeList
(
listId
);
});
describe
(
'
when list type is "milestone"
'
,
()
=>
{
beforeEach
(()
=>
{
boardsStore
.
addList
({
id
:
1
,
milestone
:
{
webUrl
:
'
https://gitlab.com/h5bp/html5-boilerplate/-/milestones/1
'
,
title
:
'
Backlog
'
,
},
max_issue_count
:
1
,
list_type
:
'
milestone
'
,
});
});
afterEach
(()
=>
{
boardsStore
.
removeList
(
1
,
'
milestone
'
);
wrapper
.
destroy
();
});
it
(
'
renders the correct milestone text
'
,
()
=>
{
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
'
.js-milestone
'
).
text
()).
toBe
(
'
Backlog
'
);
});
it
(
'
renders the correct list type text
'
,
()
=>
{
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toBe
(
'
Milestone
'
);
});
});
describe
(
'
when list type is "assignee"
'
,
()
=>
{
beforeEach
(()
=>
{
boardsStore
.
addList
({
id
:
1
,
user
:
{
username
:
'
root
'
,
avatar
:
''
,
name
:
'
Test
'
,
webUrl
:
'
https://gitlab.com/root
'
},
max_issue_count
:
1
,
list_type
:
'
assignee
'
,
});
});
afterEach
(()
=>
{
boardsStore
.
removeList
(
1
,
'
assignee
'
);
wrapper
.
destroy
();
});
it
(
'
renders gl-avatar-link with correct href
'
,
()
=>
{
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
GlAvatarLink
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLink
).
attributes
(
'
href
'
)).
toBe
(
'
https://gitlab.com/root
'
);
});
it
(
'
renders gl-avatar-labeled with "root" as username and name as "Test"
'
,
()
=>
{
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
attributes
(
'
label
'
)).
toBe
(
'
Test
'
);
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
attributes
(
'
sublabel
'
)).
toBe
(
'
@root
'
);
});
it
(
'
renders the correct list type text
'
,
()
=>
{
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toBe
(
'
Assignee
'
);
});
});
});
});
});
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