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
5d12b2d9
Commit
5d12b2d9
authored
Apr 20, 2020
by
Axel García
Committed by
Paul Slaughter
Apr 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use sidebar.closeAll event on board_column lists
parent
9c871324
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
3 deletions
+45
-3
app/assets/javascripts/boards/constants.js
app/assets/javascripts/boards/constants.js
+2
-0
ee/app/assets/javascripts/boards/components/board_column.vue
ee/app/assets/javascripts/boards/components/board_column.vue
+8
-1
ee/spec/frontend/boards/components/board_column_spec.js
ee/spec/frontend/boards/components/board_column_spec.js
+35
-2
No files found.
app/assets/javascripts/boards/constants.js
View file @
5d12b2d9
...
@@ -8,6 +8,8 @@ export const ListType = {
...
@@ -8,6 +8,8 @@ export const ListType = {
blank
:
'
blank
'
,
blank
:
'
blank
'
,
};
};
export
const
inactiveListId
=
0
;
export
default
{
export
default
{
ListType
,
ListType
,
};
};
ee/app/assets/javascripts/boards/components/board_column.vue
View file @
5d12b2d9
<
script
>
<
script
>
import
{
mapActions
}
from
'
vuex
'
;
import
{
map
State
,
map
Actions
}
from
'
vuex
'
;
import
BoardColumnFoss
from
'
~/boards/components/board_column.vue
'
;
import
BoardColumnFoss
from
'
~/boards/components/board_column.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
{
inactiveListId
}
from
'
~/boards/constants
'
;
import
BoardPromotionState
from
'
ee/boards/components/board_promotion_state
'
;
import
BoardPromotionState
from
'
ee/boards/components/board_promotion_state
'
;
import
eventHub
from
'
~/sidebar/event_hub
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -16,6 +18,7 @@ export default {
...
@@ -16,6 +18,7 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
activeListId
'
]),
issuesTooltip
()
{
issuesTooltip
()
{
const
{
issuesSize
,
maxIssueCount
}
=
this
.
list
;
const
{
issuesSize
,
maxIssueCount
}
=
this
.
list
;
...
@@ -42,6 +45,10 @@ export default {
...
@@ -42,6 +45,10 @@ export default {
methods
:
{
methods
:
{
...
mapActions
([
'
setActiveListId
'
]),
...
mapActions
([
'
setActiveListId
'
]),
openSidebarSettings
()
{
openSidebarSettings
()
{
if
(
this
.
activeListId
===
inactiveListId
)
{
eventHub
.
$emit
(
'
sidebar.closeAll
'
);
}
this
.
setActiveListId
(
this
.
list
.
id
);
this
.
setActiveListId
(
this
.
list
.
id
);
},
},
},
},
...
...
ee/spec/frontend/boards/components/board_column_spec.js
View file @
5d12b2d9
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vuex
from
'
vuex
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
AxiosMockAdapter
from
'
axios-mock-adapter
'
;
import
Board
from
'
ee/boards/components/board_column.vue
'
;
import
Board
from
'
ee/boards/components/board_column.vue
'
;
import
List
from
'
~/boards/models/list
'
;
import
List
from
'
~/boards/models/list
'
;
import
{
ListType
}
from
'
~/boards/constants
'
;
import
{
ListType
,
inactiveListId
}
from
'
~/boards/constants
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
sidebarEventHub
from
'
~/sidebar/event_hub
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
listObj
}
from
'
jest/boards/mock_data
'
;
import
{
listObj
}
from
'
jest/boards/mock_data
'
;
...
@@ -14,7 +16,12 @@ import { listObj } from 'jest/boards/mock_data';
...
@@ -14,7 +16,12 @@ import { listObj } from 'jest/boards/mock_data';
// so we are mocking it in this test
// so we are mocking it in this test
jest
.
mock
(
'
ee/boards/components/board_promotion_state
'
,
()
=>
({}));
jest
.
mock
(
'
ee/boards/components/board_promotion_state
'
,
()
=>
({}));
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
describe
(
'
Board Column Component
'
,
()
=>
{
describe
(
'
Board Column Component
'
,
()
=>
{
let
store
;
let
wrapper
;
let
wrapper
;
let
axiosMock
;
let
axiosMock
;
...
@@ -22,6 +29,8 @@ describe('Board Column Component', () => {
...
@@ -22,6 +29,8 @@ describe('Board Column 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
:
{
activeListId
:
inactiveListId
}
});
jest
.
spyOn
(
store
,
'
dispatch
'
).
mockImplementation
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -61,6 +70,8 @@ describe('Board Column Component', () => {
...
@@ -61,6 +70,8 @@ describe('Board Column Component', () => {
}
}
wrapper
=
shallowMount
(
Board
,
{
wrapper
=
shallowMount
(
Board
,
{
store
,
localVue
,
propsData
:
{
propsData
:
{
boardId
,
boardId
,
disabled
:
false
,
disabled
:
false
,
...
@@ -117,6 +128,28 @@ describe('Board Column Component', () => {
...
@@ -117,6 +128,28 @@ describe('Board Column Component', () => {
expect
([...
hasSettings
,
...
hasNoSettings
]).
toContain
(
value
);
expect
([...
hasSettings
,
...
hasNoSettings
]).
toContain
(
value
);
});
});
});
});
describe
(
'
emits sidebar.closeAll event on openSidebarSettings
'
,
()
=>
{
beforeEach
(()
=>
{
jest
.
spyOn
(
sidebarEventHub
,
'
$emit
'
);
});
it
(
'
emits event if no active List
'
,
()
=>
{
// Shares the same behavior for any settings-enabled List type
createComponent
({
listType
:
hasSettings
[
0
]
});
wrapper
.
vm
.
openSidebarSettings
();
expect
(
sidebarEventHub
.
$emit
).
toHaveBeenCalledWith
(
'
sidebar.closeAll
'
);
});
it
(
'
does not emits event when there is an active List
'
,
()
=>
{
store
.
state
.
activeListId
=
listObj
.
id
;
createComponent
({
listType
:
hasSettings
[
0
]
});
wrapper
.
vm
.
openSidebarSettings
();
expect
(
sidebarEventHub
.
$emit
).
not
.
toHaveBeenCalled
();
});
});
});
});
});
});
});
});
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