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 {
boardsStore: {
type: Object,
required: false,
default: undefined,
default: null,
},
canAdminList: {
type: Boolean,
......@@ -27,11 +27,6 @@ export default {
required: true,
},
},
data() {
return {
state: this.boardsStore ? this.boardsStore.state : {},
};
},
computed: {
buttonText() {
return this.canAdminList ? s__('Boards|Edit board') : s__('Boards|View scope');
......@@ -43,7 +38,9 @@ export default {
methods: {
showPage() {
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) => {
return;
}
gl.boardConfigToggle = new Vue({
// eslint-disable-next-line no-new
new Vue({
el,
render(h) {
return h(ConfigToggle, {
......
......@@ -118,10 +118,12 @@ RSpec.describe 'epic boards', :js do
update_board_label(label_title)
expect(page).to have_selector('.board-card', count: 1)
expect(page).to have_content('Epic1')
expect(page).not_to have_content('Epic2')
expect(page).not_to have_content('Epic3')
aggregate_failures do
expect(page).to have_selector('.board-card', count: 1)
expect(page).to have_content('Epic1')
expect(page).not_to have_content('Epic2')
expect(page).not_to have_content('Epic3')
end
end
end
......@@ -141,12 +143,14 @@ RSpec.describe 'epic boards', :js do
view_scope.click
page.within('.modal') do
expect(find('.modal-header')).to have_content('Board scope')
expect(page).not_to have_content('Board name')
expect(page).not_to have_link('Edit')
expect(page).not_to have_button('Edit')
expect(page).not_to have_button('Save')
expect(page).not_to have_button('Cancel')
aggregate_failures do
expect(find('.modal-header')).to have_content('Board scope')
expect(page).not_to have_content('Board name')
expect(page).not_to have_link('Edit')
expect(page).not_to have_button('Edit')
expect(page).not_to have_button('Save')
expect(page).not_to have_button('Cancel')
end
end
end
end
......
......@@ -124,20 +124,19 @@ describe('EE Boards Store Getters', () => {
});
describe('isEpicBoard', () => {
it('returns true when issuableType on state is epic', () => {
const state = {
issuableType: 'epic',
};
expect(getters.isEpicBoard(state)).toBe(true);
});
it('returns false when issuableType on state is not epic', () => {
const state = {
issuableType: 'issue',
};
expect(getters.isEpicBoard(state)).toBe(false);
});
it.each`
issuableType | expected
${'epic'} | ${true}
${'issue'} | ${false}
`(
'returns $expected when issuableType on state is $issuableType',
({ issuableType, expected }) => {
const state = {
issuableType,
};
expect(getters.isEpicBoard(state)).toBe(expected);
},
);
});
});
......@@ -179,21 +179,20 @@ describe('Boards - Getters', () => {
});
describe('isIssueBoard', () => {
it('returns true when issuableType on state is issue', () => {
const state = {
issuableType: 'issue',
};
expect(getters.isIssueBoard(state)).toBe(true);
});
it('returns false when issuableType on state is not issue', () => {
const state = {
issuableType: 'epic',
};
expect(getters.isIssueBoard(state)).toBe(false);
});
it.each`
issuableType | expected
${'issue'} | ${true}
${'epic'} | ${false}
`(
'returns $expected when issuableType on state is $issuableType',
({ issuableType, expected }) => {
const state = {
issuableType,
};
expect(getters.isIssueBoard(state)).toBe(expected);
},
);
});
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