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,10 +118,12 @@ RSpec.describe 'epic boards', :js do ...@@ -118,10 +118,12 @@ RSpec.describe 'epic boards', :js do
update_board_label(label_title) update_board_label(label_title)
expect(page).to have_selector('.board-card', count: 1) aggregate_failures do
expect(page).to have_content('Epic1') expect(page).to have_selector('.board-card', count: 1)
expect(page).not_to have_content('Epic2') expect(page).to have_content('Epic1')
expect(page).not_to have_content('Epic3') expect(page).not_to have_content('Epic2')
expect(page).not_to have_content('Epic3')
end
end end
end end
...@@ -141,12 +143,14 @@ RSpec.describe 'epic boards', :js do ...@@ -141,12 +143,14 @@ RSpec.describe 'epic boards', :js do
view_scope.click view_scope.click
page.within('.modal') do page.within('.modal') do
expect(find('.modal-header')).to have_content('Board scope') aggregate_failures do
expect(page).not_to have_content('Board name') expect(find('.modal-header')).to have_content('Board scope')
expect(page).not_to have_link('Edit') expect(page).not_to have_content('Board name')
expect(page).not_to have_button('Edit') expect(page).not_to have_link('Edit')
expect(page).not_to have_button('Save') expect(page).not_to have_button('Edit')
expect(page).not_to have_button('Cancel') expect(page).not_to have_button('Save')
expect(page).not_to have_button('Cancel')
end
end end
end end
end end
......
...@@ -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`
const state = { issuableType | expected
issuableType: 'epic', ${'epic'} | ${true}
}; ${'issue'} | ${false}
`(
expect(getters.isEpicBoard(state)).toBe(true); 'returns $expected when issuableType on state is $issuableType',
}); ({ issuableType, expected }) => {
const state = {
it('returns false when issuableType on state is not epic', () => { issuableType,
const state = { };
issuableType: 'issue',
}; expect(getters.isEpicBoard(state)).toBe(expected);
},
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 }) => {
const state = {
it('returns false when issuableType on state is not issue', () => { issuableType,
const state = { };
issuableType: 'epic',
}; expect(getters.isIssueBoard(state)).toBe(expected);
},
expect(getters.isIssueBoard(state)).toBe(false); );
});
}); });
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