Commit 26a68c2e authored by Florie Guibert's avatar Florie Guibert

Epic Boards - Update board scope

Review feedback
parent 614610c5
...@@ -16,7 +16,7 @@ export default { ...@@ -16,7 +16,7 @@ export default {
boardsStore: { boardsStore: {
type: Object, type: Object,
required: false, required: false,
default: undefined, default: null,
}, },
canAdminList: { canAdminList: {
type: Boolean, type: Boolean,
...@@ -27,11 +27,6 @@ export default { ...@@ -27,11 +27,6 @@ export default {
required: true, required: true,
}, },
}, },
data() {
return {
state: this.boardsStore ? this.boardsStore.state : {},
};
},
computed: { computed: {
buttonText() { buttonText() {
return this.canAdminList ? s__('Boards|Edit board') : s__('Boards|View scope'); return this.canAdminList ? s__('Boards|Edit board') : s__('Boards|View scope');
...@@ -43,7 +38,9 @@ export default { ...@@ -43,7 +38,9 @@ export default {
methods: { methods: {
showPage() { showPage() {
eventHub.$emit('showBoardModal', formType.edit); eventHub.$emit('showBoardModal', formType.edit);
return this.boardsStore ? this.boardsStore.showPage(formType.edit) : null; if (this.boardsStore) {
this.boardsStore.showPage(formType.edit);
}
}, },
}, },
}; };
......
...@@ -9,7 +9,8 @@ export default (boardsStore = undefined) => { ...@@ -9,7 +9,8 @@ export default (boardsStore = undefined) => {
return; return;
} }
gl.boardConfigToggle = new Vue({ // eslint-disable-next-line no-new
new Vue({
el, el,
render(h) { render(h) {
return h(ConfigToggle, { return h(ConfigToggle, {
......
...@@ -118,12 +118,14 @@ RSpec.describe 'epic boards', :js do ...@@ -118,12 +118,14 @@ RSpec.describe 'epic boards', :js do
update_board_label(label_title) update_board_label(label_title)
aggregate_failures do
expect(page).to have_selector('.board-card', count: 1) expect(page).to have_selector('.board-card', count: 1)
expect(page).to have_content('Epic1') expect(page).to have_content('Epic1')
expect(page).not_to have_content('Epic2') expect(page).not_to have_content('Epic2')
expect(page).not_to have_content('Epic3') expect(page).not_to have_content('Epic3')
end end
end end
end
context 'when user cannot admin epic boards' do context 'when user cannot admin epic boards' do
before do before do
...@@ -141,6 +143,7 @@ RSpec.describe 'epic boards', :js do ...@@ -141,6 +143,7 @@ RSpec.describe 'epic boards', :js do
view_scope.click view_scope.click
page.within('.modal') do page.within('.modal') do
aggregate_failures do
expect(find('.modal-header')).to have_content('Board scope') expect(find('.modal-header')).to have_content('Board scope')
expect(page).not_to have_content('Board name') expect(page).not_to have_content('Board name')
expect(page).not_to have_link('Edit') expect(page).not_to have_link('Edit')
...@@ -150,6 +153,7 @@ RSpec.describe 'epic boards', :js do ...@@ -150,6 +153,7 @@ RSpec.describe 'epic boards', :js do
end end
end end
end end
end
def visit_epic_boards_page def visit_epic_boards_page
visit group_epic_boards_path(group) visit group_epic_boards_path(group)
......
...@@ -124,20 +124,19 @@ describe('EE Boards Store Getters', () => { ...@@ -124,20 +124,19 @@ describe('EE Boards Store Getters', () => {
}); });
describe('isEpicBoard', () => { describe('isEpicBoard', () => {
it('returns true when issuableType on state is epic', () => { it.each`
issuableType | expected
${'epic'} | ${true}
${'issue'} | ${false}
`(
'returns $expected when issuableType on state is $issuableType',
({ issuableType, expected }) => {
const state = { const state = {
issuableType: 'epic', issuableType,
}; };
expect(getters.isEpicBoard(state)).toBe(true); expect(getters.isEpicBoard(state)).toBe(expected);
}); },
);
it('returns false when issuableType on state is not epic', () => {
const state = {
issuableType: 'issue',
};
expect(getters.isEpicBoard(state)).toBe(false);
});
}); });
}); });
...@@ -179,21 +179,20 @@ describe('Boards - Getters', () => { ...@@ -179,21 +179,20 @@ describe('Boards - Getters', () => {
}); });
describe('isIssueBoard', () => { describe('isIssueBoard', () => {
it('returns true when issuableType on state is issue', () => { it.each`
const state = { issuableType | expected
issuableType: 'issue', ${'issue'} | ${true}
}; ${'epic'} | ${false}
`(
expect(getters.isIssueBoard(state)).toBe(true); 'returns $expected when issuableType on state is $issuableType',
}); ({ issuableType, expected }) => {
it('returns false when issuableType on state is not issue', () => {
const state = { const state = {
issuableType: 'epic', issuableType,
}; };
expect(getters.isIssueBoard(state)).toBe(false); expect(getters.isIssueBoard(state)).toBe(expected);
}); },
);
}); });
describe('isEpicBoard', () => { describe('isEpicBoard', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment