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
06212e0c
Commit
06212e0c
authored
Jul 24, 2020
by
Scott Stern
Committed by
Andrew Fontaine
Jul 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename listid to id for generalization of sidebar mechanism
parent
a8d7c5d4
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
71 additions
and
75 deletions
+71
-75
app/assets/javascripts/boards/constants.js
app/assets/javascripts/boards/constants.js
+1
-1
app/assets/javascripts/boards/stores/state.js
app/assets/javascripts/boards/stores/state.js
+2
-2
ee/app/assets/javascripts/boards/components/board_list_header.vue
...ssets/javascripts/boards/components/board_list_header.vue
+5
-5
ee/app/assets/javascripts/boards/components/board_settings_sidebar.vue
.../javascripts/boards/components/board_settings_sidebar.vue
+14
-14
ee/app/assets/javascripts/boards/stores/actions.js
ee/app/assets/javascripts/boards/stores/actions.js
+3
-3
ee/app/assets/javascripts/boards/stores/mutations.js
ee/app/assets/javascripts/boards/stores/mutations.js
+1
-1
ee/spec/frontend/boards/components/board_list_header_spec.js
ee/spec/frontend/boards/components/board_list_header_spec.js
+3
-3
ee/spec/frontend/boards/components/board_settings_sidebar_spec.js
...frontend/boards/components/board_settings_sidebar_spec.js
+32
-36
ee/spec/frontend/boards/stores/actions_spec.js
ee/spec/frontend/boards/stores/actions_spec.js
+7
-7
ee/spec/frontend/boards/stores/mutations_spec.js
ee/spec/frontend/boards/stores/mutations_spec.js
+3
-3
No files found.
app/assets/javascripts/boards/constants.js
View file @
06212e0c
...
@@ -13,7 +13,7 @@ export const ListType = {
...
@@ -13,7 +13,7 @@ export const ListType = {
blank
:
'
blank
'
,
blank
:
'
blank
'
,
};
};
export
const
inactive
List
Id
=
0
;
export
const
inactiveId
=
0
;
export
default
{
export
default
{
BoardType
,
BoardType
,
...
...
app/assets/javascripts/boards/stores/state.js
View file @
06212e0c
import
{
inactive
List
Id
}
from
'
~/boards/constants
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
export
default
()
=>
({
export
default
()
=>
({
endpoints
:
{},
endpoints
:
{},
isShowingLabels
:
true
,
isShowingLabels
:
true
,
active
ListId
:
inactiveList
Id
,
active
Id
:
inactive
Id
,
});
});
ee/app/assets/javascripts/boards/components/board_list_header.vue
View file @
06212e0c
...
@@ -3,7 +3,7 @@ import { mapState, mapActions } from 'vuex';
...
@@ -3,7 +3,7 @@ import { mapState, mapActions } from 'vuex';
import
BoardListHeaderFoss
from
'
~/boards/components/board_list_header.vue
'
;
import
BoardListHeaderFoss
from
'
~/boards/components/board_list_header.vue
'
;
import
{
__
,
sprintf
,
s__
}
from
'
~/locale
'
;
import
{
__
,
sprintf
,
s__
}
from
'
~/locale
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
boardsStore
from
'
~/boards/stores/boards_store
'
;
import
{
inactive
List
Id
}
from
'
~/boards/constants
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
export
default
{
export
default
{
...
@@ -14,7 +14,7 @@ export default {
...
@@ -14,7 +14,7 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
active
List
Id
'
]),
...
mapState
([
'
activeId
'
]),
issuesTooltip
()
{
issuesTooltip
()
{
const
{
issuesSize
,
maxIssueCount
}
=
this
.
list
;
const
{
issuesSize
,
maxIssueCount
}
=
this
.
list
;
...
@@ -39,13 +39,13 @@ export default {
...
@@ -39,13 +39,13 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
setActive
List
Id
'
]),
...
mapActions
([
'
setActiveId
'
]),
openSidebarSettings
()
{
openSidebarSettings
()
{
if
(
this
.
active
ListId
===
inactiveList
Id
)
{
if
(
this
.
active
Id
===
inactive
Id
)
{
eventHub
.
$emit
(
'
sidebar.closeAll
'
);
eventHub
.
$emit
(
'
sidebar.closeAll
'
);
}
}
this
.
setActive
List
Id
(
this
.
list
.
id
);
this
.
setActiveId
(
this
.
list
.
id
);
},
},
},
},
};
};
...
...
ee/app/assets/javascripts/boards/components/board_settings_sidebar.vue
View file @
06212e0c
...
@@ -15,7 +15,7 @@ import boardsStoreEE from '../stores/boards_store_ee';
...
@@ -15,7 +15,7 @@ import boardsStoreEE from '../stores/boards_store_ee';
import
eventHub
from
'
~/sidebar/event_hub
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
import
flash
from
'
~/flash
'
;
import
flash
from
'
~/flash
'
;
import
{
isScopedLabel
}
from
'
~/lib/utils/common_utils
'
;
import
{
isScopedLabel
}
from
'
~/lib/utils/common_utils
'
;
import
{
inactive
List
Id
}
from
'
~/boards/constants
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
// NOTE: need to revisit how we handle headerHeight, because we have so many different header and footer options.
// NOTE: need to revisit how we handle headerHeight, because we have so many different header and footer options.
export
default
{
export
default
{
...
@@ -52,16 +52,16 @@ export default {
...
@@ -52,16 +52,16 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
active
List
Id
'
]),
...
mapState
([
'
activeId
'
]),
activeList
()
{
activeList
()
{
/*
/*
Warning: Though a computed property it is not reactive because we are
Warning: Though a computed property it is not reactive because we are
referencing a List Model class. Reactivity only applies to plain JS objects
referencing a List Model class. Reactivity only applies to plain JS objects
*/
*/
return
boardsStoreEE
.
store
.
state
.
lists
.
find
(({
id
})
=>
id
===
this
.
active
List
Id
);
return
boardsStoreEE
.
store
.
state
.
lists
.
find
(({
id
})
=>
id
===
this
.
activeId
);
},
},
isSidebarOpen
()
{
isSidebarOpen
()
{
return
this
.
active
ListId
!==
inactiveList
Id
;
return
this
.
active
Id
!==
inactive
Id
;
},
},
activeListLabel
()
{
activeListLabel
()
{
return
this
.
activeList
.
label
;
return
this
.
activeList
.
label
;
...
@@ -108,10 +108,10 @@ export default {
...
@@ -108,10 +108,10 @@ export default {
eventHub
.
$off
(
'
sidebar.closeAll
'
,
this
.
closeSidebar
);
eventHub
.
$off
(
'
sidebar.closeAll
'
,
this
.
closeSidebar
);
},
},
methods
:
{
methods
:
{
...
mapActions
([
'
setActive
List
Id
'
,
'
updateListWipLimit
'
]),
...
mapActions
([
'
setActiveId
'
,
'
updateListWipLimit
'
]),
closeSidebar
()
{
closeSidebar
()
{
this
.
edit
=
false
;
this
.
edit
=
false
;
this
.
setActive
ListId
(
inactiveList
Id
);
this
.
setActive
Id
(
inactive
Id
);
},
},
showInput
()
{
showInput
()
{
this
.
edit
=
true
;
this
.
edit
=
true
;
...
@@ -128,7 +128,7 @@ export default {
...
@@ -128,7 +128,7 @@ export default {
this
.
updating
=
true
;
this
.
updating
=
true
;
// need to reassign bc were clearing the ref in resetStateAfterUpdate.
// need to reassign bc were clearing the ref in resetStateAfterUpdate.
const
wipLimit
=
this
.
currentWipLimit
;
const
wipLimit
=
this
.
currentWipLimit
;
const
id
=
this
.
active
List
Id
;
const
id
=
this
.
activeId
;
this
.
updateListWipLimit
({
maxIssueCount
:
this
.
currentWipLimit
,
id
})
this
.
updateListWipLimit
({
maxIssueCount
:
this
.
currentWipLimit
,
id
})
.
then
(()
=>
{
.
then
(()
=>
{
...
@@ -137,7 +137,7 @@ export default {
...
@@ -137,7 +137,7 @@ export default {
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
resetStateAfterUpdate
();
this
.
resetStateAfterUpdate
();
this
.
setActive
ListId
(
inactiveList
Id
);
this
.
setActive
Id
(
inactive
Id
);
flash
(
__
(
'
Something went wrong while updating your list settings
'
));
flash
(
__
(
'
Something went wrong while updating your list settings
'
));
});
});
}
else
{
}
else
{
...
@@ -145,14 +145,14 @@ export default {
...
@@ -145,14 +145,14 @@ export default {
}
}
},
},
clearWipLimit
()
{
clearWipLimit
()
{
this
.
updateListWipLimit
({
maxIssueCount
:
0
,
id
:
this
.
active
List
Id
})
this
.
updateListWipLimit
({
maxIssueCount
:
0
,
id
:
this
.
activeId
})
.
then
(()
=>
{
.
then
(()
=>
{
boardsStoreEE
.
setMaxIssueCountOnList
(
this
.
active
List
Id
,
0
);
boardsStoreEE
.
setMaxIssueCountOnList
(
this
.
activeId
,
0
);
this
.
resetStateAfterUpdate
();
this
.
resetStateAfterUpdate
();
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
this
.
resetStateAfterUpdate
();
this
.
resetStateAfterUpdate
();
this
.
setActive
ListId
(
inactiveList
Id
);
this
.
setActive
Id
(
inactive
Id
);
flash
(
__
(
'
Something went wrong while updating your list settings
'
));
flash
(
__
(
'
Something went wrong while updating your list settings
'
));
});
});
},
},
...
@@ -202,9 +202,9 @@ export default {
...
@@ -202,9 +202,9 @@ export default {
</gl-avatar-link>
</gl-avatar-link>
</
template
>
</
template
>
<
template
v-else-if=
"boardListType === $options.milestone"
>
<
template
v-else-if=
"boardListType === $options.milestone"
>
<gl-link
class=
"js-milestone"
:href=
"activeListMilestone.webUrl"
>
{{
<gl-link
class=
"js-milestone"
:href=
"activeListMilestone.webUrl"
>
activeListMilestone
.
title
{{
activeListMilestone
.
title
}}
}}
</gl-link>
</gl-link>
</
template
>
</
template
>
</div>
</div>
<div
class=
"d-flex justify-content-between flex-column"
>
<div
class=
"d-flex justify-content-between flex-column"
>
...
...
ee/app/assets/javascripts/boards/stores/actions.js
View file @
06212e0c
...
@@ -67,13 +67,13 @@ export default {
...
@@ -67,13 +67,13 @@ export default {
commit
(
types
.
SET_SHOW_LABELS
,
val
);
commit
(
types
.
SET_SHOW_LABELS
,
val
);
},
},
setActive
List
Id
({
commit
},
listId
)
{
setActiveId
({
commit
},
listId
)
{
commit
(
types
.
SET_ACTIVE_LIST_ID
,
listId
);
commit
(
types
.
SET_ACTIVE_LIST_ID
,
listId
);
},
},
updateListWipLimit
({
state
},
{
maxIssueCount
})
{
updateListWipLimit
({
state
},
{
maxIssueCount
})
{
const
{
active
List
Id
}
=
state
;
const
{
activeId
}
=
state
;
return
axios
.
put
(
`
${
boardsStoreEE
.
store
.
state
.
endpoints
.
listsEndpoint
}
/
${
active
List
Id
}
`
,
{
return
axios
.
put
(
`
${
boardsStoreEE
.
store
.
state
.
endpoints
.
listsEndpoint
}
/
${
activeId
}
`
,
{
list
:
{
list
:
{
max_issue_count
:
maxIssueCount
,
max_issue_count
:
maxIssueCount
,
},
},
...
...
ee/app/assets/javascripts/boards/stores/mutations.js
View file @
06212e0c
...
@@ -12,7 +12,7 @@ export default {
...
@@ -12,7 +12,7 @@ export default {
state
.
isShowingLabels
=
val
;
state
.
isShowingLabels
=
val
;
},
},
[
mutationTypes
.
SET_ACTIVE_LIST_ID
]:
(
state
,
id
)
=>
{
[
mutationTypes
.
SET_ACTIVE_LIST_ID
]:
(
state
,
id
)
=>
{
state
.
active
List
Id
=
id
;
state
.
activeId
=
id
;
},
},
[
mutationTypes
.
REQUEST_AVAILABLE_BOARDS
]:
()
=>
{
[
mutationTypes
.
REQUEST_AVAILABLE_BOARDS
]:
()
=>
{
...
...
ee/spec/frontend/boards/components/board_list_header_spec.js
View file @
06212e0c
...
@@ -5,7 +5,7 @@ import AxiosMockAdapter from 'axios-mock-adapter';
...
@@ -5,7 +5,7 @@ import AxiosMockAdapter from 'axios-mock-adapter';
import
BoardListHeader
from
'
ee/boards/components/board_list_header.vue
'
;
import
BoardListHeader
from
'
ee/boards/components/board_list_header.vue
'
;
import
List
from
'
~/boards/models/list
'
;
import
List
from
'
~/boards/models/list
'
;
import
{
ListType
,
inactive
List
Id
}
from
'
~/boards/constants
'
;
import
{
ListType
,
inactiveId
}
from
'
~/boards/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
...
@@ -29,7 +29,7 @@ describe('Board List Header Component', () => {
...
@@ -29,7 +29,7 @@ describe('Board List Header Component', () => {
window
.
gon
=
{};
window
.
gon
=
{};
axiosMock
=
new
AxiosMockAdapter
(
axios
);
axiosMock
=
new
AxiosMockAdapter
(
axios
);
axiosMock
.
onGet
(
`
${
TEST_HOST
}
/lists/1/issues`
).
reply
(
200
,
{
issues
:
[]
});
axiosMock
.
onGet
(
`
${
TEST_HOST
}
/lists/1/issues`
).
reply
(
200
,
{
issues
:
[]
});
store
=
new
Vuex
.
Store
({
state
:
{
active
ListId
:
inactiveList
Id
}
});
store
=
new
Vuex
.
Store
({
state
:
{
active
Id
:
inactive
Id
}
});
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
();
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
();
});
});
...
@@ -145,7 +145,7 @@ describe('Board List Header Component', () => {
...
@@ -145,7 +145,7 @@ describe('Board List Header Component', () => {
});
});
it
(
'
does not emits event when there is an active List
'
,
()
=>
{
it
(
'
does not emits event when there is an active List
'
,
()
=>
{
store
.
state
.
active
List
Id
=
listObj
.
id
;
store
.
state
.
activeId
=
listObj
.
id
;
createComponent
({
listType
:
hasSettings
[
0
]
});
createComponent
({
listType
:
hasSettings
[
0
]
});
wrapper
.
vm
.
openSidebarSettings
();
wrapper
.
vm
.
openSidebarSettings
();
...
...
ee/spec/frontend/boards/components/board_settings_sidebar_spec.js
View file @
06212e0c
...
@@ -11,7 +11,7 @@ import bs from '~/boards/stores/boards_store';
...
@@ -11,7 +11,7 @@ import bs from '~/boards/stores/boards_store';
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
import
flash
from
'
~/flash
'
;
import
flash
from
'
~/flash
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
{
inactive
List
Id
}
from
'
~/boards/constants
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
jest
.
mock
(
'
~/flash
'
);
jest
.
mock
(
'
~/flash
'
);
// NOTE: needed for calling boardsStore.addList
// NOTE: needed for calling boardsStore.addList
...
@@ -29,11 +29,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -29,11 +29,7 @@ describe('BoardSettingsSideBar', () => {
const
listId
=
1
;
const
listId
=
1
;
const
currentWipLimit
=
1
;
// Needs to be other than null to trigger requests.
const
currentWipLimit
=
1
;
// Needs to be other than null to trigger requests.
const
createComponent
=
(
const
createComponent
=
(
state
=
{
activeId
:
inactiveId
},
actions
=
{},
localState
=
{})
=>
{
state
=
{
activeListId
:
inactiveListId
},
actions
=
{},
localState
=
{},
)
=>
{
storeActions
=
actions
;
storeActions
=
actions
;
const
store
=
new
Vuex
.
Store
({
const
store
=
new
Vuex
.
Store
({
...
@@ -93,35 +89,35 @@ describe('BoardSettingsSideBar', () => {
...
@@ -93,35 +89,35 @@ describe('BoardSettingsSideBar', () => {
describe
(
'
on close
'
,
()
=>
{
describe
(
'
on close
'
,
()
=>
{
it
(
'
calls closeSidebar
'
,
()
=>
{
it
(
'
calls closeSidebar
'
,
()
=>
{
const
spy
=
jest
.
fn
();
const
spy
=
jest
.
fn
();
createComponent
({
active
ListId
:
inactiveListId
},
{
setActiveList
Id
:
spy
});
createComponent
({
active
Id
:
inactiveId
},
{
setActive
Id
:
spy
});
wrapper
.
find
(
GlDrawer
).
vm
.
$emit
(
'
close
'
);
wrapper
.
find
(
GlDrawer
).
vm
.
$emit
(
'
close
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
storeActions
.
setActive
List
Id
).
toHaveBeenCalledWith
(
expect
(
storeActions
.
setActiveId
).
toHaveBeenCalledWith
(
expect
.
anything
(),
expect
.
anything
(),
inactive
List
Id
,
inactiveId
,
undefined
,
undefined
,
);
);
});
});
});
});
it
(
'
calls closeSidebar on sidebar.closeAll event
'
,
()
=>
{
it
(
'
calls closeSidebar on sidebar.closeAll event
'
,
()
=>
{
createComponent
({
active
ListId
:
inactiveListId
},
{
setActiveList
Id
:
jest
.
fn
()
});
createComponent
({
active
Id
:
inactiveId
},
{
setActive
Id
:
jest
.
fn
()
});
sidebarEventHub
.
$emit
(
'
sidebar.closeAll
'
);
sidebarEventHub
.
$emit
(
'
sidebar.closeAll
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
storeActions
.
setActive
List
Id
).
toHaveBeenCalledWith
(
expect
(
storeActions
.
setActiveId
).
toHaveBeenCalledWith
(
expect
.
anything
(),
expect
.
anything
(),
inactive
List
Id
,
inactiveId
,
undefined
,
undefined
,
);
);
});
});
});
});
});
});
describe
(
'
when active
List
Id is zero
'
,
()
=>
{
describe
(
'
when activeId is zero
'
,
()
=>
{
it
(
'
renders GlDrawer with open false
'
,
()
=>
{
it
(
'
renders GlDrawer with open false
'
,
()
=>
{
createComponent
();
createComponent
();
...
@@ -129,7 +125,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -129,7 +125,7 @@ describe('BoardSettingsSideBar', () => {
});
});
});
});
describe
(
'
when active
List
Id is greater than zero
'
,
()
=>
{
describe
(
'
when activeId is greater than zero
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
...
@@ -145,13 +141,13 @@ describe('BoardSettingsSideBar', () => {
...
@@ -145,13 +141,13 @@ describe('BoardSettingsSideBar', () => {
});
});
it
(
'
renders GlDrawer with open false
'
,
()
=>
{
it
(
'
renders GlDrawer with open false
'
,
()
=>
{
createComponent
({
active
List
Id
:
1
});
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
GlDrawer
).
props
(
'
open
'
)).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlDrawer
).
props
(
'
open
'
)).
toBe
(
true
);
});
});
});
});
describe
(
'
when active
List
Id is in boardsStore
'
,
()
=>
{
describe
(
'
when activeId is in boardsStore
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
...
@@ -161,7 +157,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -161,7 +157,7 @@ describe('BoardSettingsSideBar', () => {
list_type
:
'
label
'
,
list_type
:
'
label
'
,
});
});
createComponent
({
active
List
Id
:
listId
});
createComponent
({
activeId
:
listId
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -177,13 +173,13 @@ describe('BoardSettingsSideBar', () => {
...
@@ -177,13 +173,13 @@ describe('BoardSettingsSideBar', () => {
});
});
});
});
describe
(
'
when active
List
Id is not in boardsStore
'
,
()
=>
{
describe
(
'
when activeId is not in boardsStore
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
mock
=
new
MockAdapter
(
axios
);
mock
=
new
MockAdapter
(
axios
);
boardsStore
.
store
.
addList
({
id
:
listId
,
label
:
{
title
:
labelTitle
,
color
:
labelColor
}
});
boardsStore
.
store
.
addList
({
id
:
listId
,
label
:
{
title
:
labelTitle
,
color
:
labelColor
}
});
createComponent
({
active
ListId
:
inactiveList
Id
});
createComponent
({
active
Id
:
inactive
Id
});
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -216,7 +212,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -216,7 +212,7 @@ describe('BoardSettingsSideBar', () => {
});
});
it
(
'
renders "None" in the block
'
,
()
=>
{
it
(
'
renders "None" in the block
'
,
()
=>
{
createComponent
({
active
List
Id
:
listId
});
createComponent
({
activeId
:
listId
});
expect
(
wrapper
.
find
(
'
.js-wip-limit
'
).
text
()).
toMatchSnapshot
();
expect
(
wrapper
.
find
(
'
.js-wip-limit
'
).
text
()).
toMatchSnapshot
();
});
});
...
@@ -242,13 +238,13 @@ describe('BoardSettingsSideBar', () => {
...
@@ -242,13 +238,13 @@ describe('BoardSettingsSideBar', () => {
});
});
it
(
'
renders the correct milestone text
'
,
()
=>
{
it
(
'
renders the correct milestone text
'
,
()
=>
{
createComponent
({
active
List
Id
:
1
});
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
'
.js-milestone
'
).
text
()).
toMatchSnapshot
();
expect
(
wrapper
.
find
(
'
.js-milestone
'
).
text
()).
toMatchSnapshot
();
});
});
it
(
'
renders the correct list type text
'
,
()
=>
{
it
(
'
renders the correct list type text
'
,
()
=>
{
createComponent
({
active
List
Id
:
1
});
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toMatchSnapshot
();
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toMatchSnapshot
();
});
});
...
@@ -270,14 +266,14 @@ describe('BoardSettingsSideBar', () => {
...
@@ -270,14 +266,14 @@ describe('BoardSettingsSideBar', () => {
});
});
it
(
'
renders gl-avatar-link with correct href
'
,
()
=>
{
it
(
'
renders gl-avatar-link with correct href
'
,
()
=>
{
createComponent
({
active
List
Id
:
1
});
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
GlAvatarLink
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLink
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLink
).
attributes
(
'
href
'
)).
toEqual
(
'
https://gitlab.com/root
'
);
expect
(
wrapper
.
find
(
GlAvatarLink
).
attributes
(
'
href
'
)).
toEqual
(
'
https://gitlab.com/root
'
);
});
});
it
(
'
renders gl-avatar-labeled with "root" as username and name as "Test"
'
,
()
=>
{
it
(
'
renders gl-avatar-labeled with "root" as username and name as "Test"
'
,
()
=>
{
createComponent
({
active
List
Id
:
1
});
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
exists
()).
toBe
(
true
);
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
attributes
(
'
label
'
)).
toEqual
(
'
Test
'
);
expect
(
wrapper
.
find
(
GlAvatarLabeled
).
attributes
(
'
label
'
)).
toEqual
(
'
Test
'
);
...
@@ -285,7 +281,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -285,7 +281,7 @@ describe('BoardSettingsSideBar', () => {
});
});
it
(
'
renders the correct list type text
'
,
()
=>
{
it
(
'
renders the correct list type text
'
,
()
=>
{
createComponent
({
active
List
Id
:
1
});
createComponent
({
activeId
:
1
});
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toMatchSnapshot
();
expect
(
wrapper
.
find
(
'
.js-list-label
'
).
text
()).
toMatchSnapshot
();
});
});
...
@@ -303,7 +299,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -303,7 +299,7 @@ describe('BoardSettingsSideBar', () => {
list_type
:
'
label
'
,
list_type
:
'
label
'
,
});
});
createComponent
({
active
List
Id
:
num
});
createComponent
({
activeId
:
num
});
expect
(
wrapper
.
find
(
'
.js-wip-limit
'
).
text
()).
toMatchSnapshot
();
expect
(
wrapper
.
find
(
'
.js-wip-limit
'
).
text
()).
toMatchSnapshot
();
});
});
...
@@ -320,7 +316,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -320,7 +316,7 @@ describe('BoardSettingsSideBar', () => {
list_type
:
'
label
'
,
list_type
:
'
label
'
,
});
});
createComponent
({
active
List
Id
:
listId
},
{
updateListWipLimit
:
()
=>
{}
});
createComponent
({
activeId
:
listId
},
{
updateListWipLimit
:
()
=>
{}
});
});
});
it
(
'
renders an input
'
,
()
=>
{
it
(
'
renders an input
'
,
()
=>
{
...
@@ -364,7 +360,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -364,7 +360,7 @@ describe('BoardSettingsSideBar', () => {
config
:
{
data
:
JSON
.
stringify
({
list
:
{
max_issue_count
:
0
}
})
},
config
:
{
data
:
JSON
.
stringify
({
list
:
{
max_issue_count
:
0
}
})
},
});
});
createComponent
({
active
List
Id
:
listId
},
{
updateListWipLimit
:
spy
});
createComponent
({
activeId
:
listId
},
{
updateListWipLimit
:
spy
});
});
});
it
(
'
resets wipLimit to 0
'
,
()
=>
{
it
(
'
resets wipLimit to 0
'
,
()
=>
{
...
@@ -388,7 +384,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -388,7 +384,7 @@ describe('BoardSettingsSideBar', () => {
list_type
:
'
label
'
,
list_type
:
'
label
'
,
});
});
createComponent
({
active
List
Id
:
listId
},
{
updateListWipLimit
:
()
=>
{}
});
createComponent
({
activeId
:
listId
},
{
updateListWipLimit
:
()
=>
{}
});
});
});
it
(
'
does not render the remove limit button
'
,
()
=>
{
it
(
'
does not render the remove limit button
'
,
()
=>
{
...
@@ -425,7 +421,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -425,7 +421,7 @@ describe('BoardSettingsSideBar', () => {
config
:
{
data
:
JSON
.
stringify
({
list
:
{
max_issue_count
:
'
4
'
}
})
},
config
:
{
data
:
JSON
.
stringify
({
list
:
{
max_issue_count
:
'
4
'
}
})
},
});
});
createComponent
(
createComponent
(
{
active
List
Id
:
1
},
{
activeId
:
1
},
{
updateListWipLimit
:
spy
},
{
updateListWipLimit
:
spy
},
{
edit
:
true
,
currentWipLimit
},
{
edit
:
true
,
currentWipLimit
},
);
);
...
@@ -441,7 +437,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -441,7 +437,7 @@ describe('BoardSettingsSideBar', () => {
it
(
'
doesnt call updateListWipLimit
'
,
()
=>
{
it
(
'
doesnt call updateListWipLimit
'
,
()
=>
{
const
spy
=
jest
.
fn
().
mockResolvedValue
({});
const
spy
=
jest
.
fn
().
mockResolvedValue
({});
createComponent
(
createComponent
(
{
active
List
Id
:
1
},
{
activeId
:
1
},
{
updateListWipLimit
:
spy
},
{
updateListWipLimit
:
spy
},
{
edit
:
true
,
currentWipLimit
:
2
},
{
edit
:
true
,
currentWipLimit
:
2
},
);
);
...
@@ -458,7 +454,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -458,7 +454,7 @@ describe('BoardSettingsSideBar', () => {
it
(
'
doesnt call updateListWipLimit
'
,
()
=>
{
it
(
'
doesnt call updateListWipLimit
'
,
()
=>
{
const
spy
=
jest
.
fn
().
mockResolvedValue
({});
const
spy
=
jest
.
fn
().
mockResolvedValue
({});
createComponent
(
createComponent
(
{
active
List
Id
:
1
},
{
activeId
:
1
},
{
updateListWipLimit
:
spy
},
{
updateListWipLimit
:
spy
},
{
edit
:
true
,
currentWipLimit
:
null
},
{
edit
:
true
,
currentWipLimit
:
null
},
);
);
...
@@ -477,7 +473,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -477,7 +473,7 @@ describe('BoardSettingsSideBar', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
spy
=
jest
.
fn
().
mockResolvedValue
({});
const
spy
=
jest
.
fn
().
mockResolvedValue
({});
createComponent
(
createComponent
(
{
active
List
Id
:
1
},
{
activeId
:
1
},
{
updateListWipLimit
:
spy
},
{
updateListWipLimit
:
spy
},
{
edit
:
true
,
currentWipLimit
:
maxIssueCount
},
{
edit
:
true
,
currentWipLimit
:
maxIssueCount
},
);
);
...
@@ -508,8 +504,8 @@ describe('BoardSettingsSideBar', () => {
...
@@ -508,8 +504,8 @@ describe('BoardSettingsSideBar', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
const
spy
=
jest
.
fn
().
mockRejectedValue
();
const
spy
=
jest
.
fn
().
mockRejectedValue
();
createComponent
(
createComponent
(
{
active
List
Id
:
1
},
{
activeId
:
1
},
{
updateListWipLimit
:
spy
,
setActive
List
Id
:
()
=>
{}
},
{
updateListWipLimit
:
spy
,
setActiveId
:
()
=>
{}
},
{
edit
:
true
,
currentWipLimit
},
{
edit
:
true
,
currentWipLimit
},
);
);
...
@@ -527,7 +523,7 @@ describe('BoardSettingsSideBar', () => {
...
@@ -527,7 +523,7 @@ describe('BoardSettingsSideBar', () => {
describe
(
'
passing of props to gl-form-input
'
,
()
=>
{
describe
(
'
passing of props to gl-form-input
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
({
active
List
Id
:
listId
},
{
updateListWipLimit
:
()
=>
{}
},
{
edit
:
true
});
createComponent
({
activeId
:
listId
},
{
updateListWipLimit
:
()
=>
{}
},
{
edit
:
true
});
});
});
it
(
'
passes `trim`
'
,
()
=>
{
it
(
'
passes `trim`
'
,
()
=>
{
...
...
ee/spec/frontend/boards/stores/actions_spec.js
View file @
06212e0c
...
@@ -3,7 +3,7 @@ import boardsStoreEE from 'ee/boards/stores/boards_store_ee';
...
@@ -3,7 +3,7 @@ import boardsStoreEE from 'ee/boards/stores/boards_store_ee';
import
actions
from
'
ee/boards/stores/actions
'
;
import
actions
from
'
ee/boards/stores/actions
'
;
import
*
as
types
from
'
ee/boards/stores/mutation_types
'
;
import
*
as
types
from
'
ee/boards/stores/mutation_types
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
testAction
from
'
helpers/vuex_action_helper
'
;
import
{
inactive
List
Id
}
from
'
~/boards/constants
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
jest
.
mock
(
'
axios
'
);
jest
.
mock
(
'
axios
'
);
...
@@ -30,14 +30,14 @@ describe('setShowLabels', () => {
...
@@ -30,14 +30,14 @@ describe('setShowLabels', () => {
});
});
});
});
describe
(
'
setActive
List
Id
'
,
()
=>
{
describe
(
'
setActiveId
'
,
()
=>
{
it
(
'
should commit mutation SET_ACTIVE_LIST_ID
'
,
done
=>
{
it
(
'
should commit mutation SET_ACTIVE_LIST_ID
'
,
done
=>
{
const
state
=
{
const
state
=
{
active
ListId
:
inactiveList
Id
,
active
Id
:
inactive
Id
,
};
};
testAction
(
testAction
(
actions
.
setActive
List
Id
,
actions
.
setActiveId
,
1
,
1
,
state
,
state
,
[{
type
:
types
.
SET_ACTIVE_LIST_ID
,
payload
:
1
}],
[{
type
:
types
.
SET_ACTIVE_LIST_ID
,
payload
:
1
}],
...
@@ -63,11 +63,11 @@ describe('updateListWipLimit', () => {
...
@@ -63,11 +63,11 @@ describe('updateListWipLimit', () => {
it
(
'
should call the correct url
'
,
()
=>
{
it
(
'
should call the correct url
'
,
()
=>
{
axios
.
put
.
mockResolvedValue
({
data
:
{}
});
axios
.
put
.
mockResolvedValue
({
data
:
{}
});
const
maxIssueCount
=
0
;
const
maxIssueCount
=
0
;
const
active
List
Id
=
1
;
const
activeId
=
1
;
return
actions
.
updateListWipLimit
({
state
:
{
active
List
Id
}
},
{
maxIssueCount
}).
then
(()
=>
{
return
actions
.
updateListWipLimit
({
state
:
{
activeId
}
},
{
maxIssueCount
}).
then
(()
=>
{
expect
(
axios
.
put
).
toHaveBeenCalledWith
(
expect
(
axios
.
put
).
toHaveBeenCalledWith
(
`
${
boardsStoreEE
.
store
.
state
.
endpoints
.
listsEndpoint
}
/
${
active
List
Id
}
`
,
`
${
boardsStoreEE
.
store
.
state
.
endpoints
.
listsEndpoint
}
/
${
activeId
}
`
,
{
list
:
{
max_issue_count
:
maxIssueCount
}
},
{
list
:
{
max_issue_count
:
maxIssueCount
}
},
);
);
});
});
...
...
ee/spec/frontend/boards/stores/mutations_spec.js
View file @
06212e0c
import
mutations
from
'
ee/boards/stores/mutations
'
;
import
mutations
from
'
ee/boards/stores/mutations
'
;
import
{
inactive
List
Id
}
from
'
~/boards/constants
'
;
import
{
inactiveId
}
from
'
~/boards/constants
'
;
import
{
mockLists
,
mockEpics
}
from
'
../mock_data
'
;
import
{
mockLists
,
mockEpics
}
from
'
../mock_data
'
;
const
expectNotImplemented
=
action
=>
{
const
expectNotImplemented
=
action
=>
{
...
@@ -24,12 +24,12 @@ describe('SET_ACTIVE_LIST_ID', () => {
...
@@ -24,12 +24,12 @@ describe('SET_ACTIVE_LIST_ID', () => {
it
(
'
updates aciveListId to be the value that is passed
'
,
()
=>
{
it
(
'
updates aciveListId to be the value that is passed
'
,
()
=>
{
const
expectedId
=
1
;
const
expectedId
=
1
;
const
state
=
{
const
state
=
{
active
ListId
:
inactiveList
Id
,
active
Id
:
inactive
Id
,
};
};
mutations
.
SET_ACTIVE_LIST_ID
(
state
,
expectedId
);
mutations
.
SET_ACTIVE_LIST_ID
(
state
,
expectedId
);
expect
(
state
.
active
List
Id
).
toBe
(
expectedId
);
expect
(
state
.
activeId
).
toBe
(
expectedId
);
});
});
});
});
...
...
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