Commit 7e6026ca authored by Phil Hughes's avatar Phil Hughes

Updated specs

parent c24d849f
...@@ -59,6 +59,9 @@ const extraMilestones = require('../mixins/extra_milestones'); ...@@ -59,6 +59,9 @@ const extraMilestones = require('../mixins/extra_milestones');
}, },
}, },
methods: { methods: {
refreshPage() {
location.href = location.pathname;
},
loadMilestones(e) { loadMilestones(e) {
this.milestoneDropdownOpen = !this.milestoneDropdownOpen; this.milestoneDropdownOpen = !this.milestoneDropdownOpen;
BoardService.loadMilestones.call(this); BoardService.loadMilestones.call(this);
...@@ -78,8 +81,12 @@ const extraMilestones = require('../mixins/extra_milestones'); ...@@ -78,8 +81,12 @@ const extraMilestones = require('../mixins/extra_milestones');
gl.boardService.createBoard(this.board) gl.boardService.createBoard(this.board)
.then(() => { .then(() => {
if (this.currentBoard && this.currentPage !== 'new') { if (this.currentBoard && this.currentPage !== 'new') {
this.currentBoard.name = this.board.name;
if (this.currentPage === 'milestone') {
// We reload the page to make sure the store & state of the app are correct // We reload the page to make sure the store & state of the app are correct
location.reload(); this.refreshPage();
}
} }
// Enable the button thanks to our jQuery disabling it // Enable the button thanks to our jQuery disabling it
......
...@@ -26,7 +26,7 @@ describe 'Board with milestone', :feature, :js do ...@@ -26,7 +26,7 @@ describe 'Board with milestone', :feature, :js do
click_link 'test' click_link 'test'
expect(find('.js-milestone-select')).to have_content(milestone.title) expect(find('.tokens-container')).to have_content(milestone.title)
expect(all('.board')[1]).to have_selector('.card', count: 1) expect(all('.board')[1]).to have_selector('.card', count: 1)
end end
end end
...@@ -48,21 +48,22 @@ describe 'Board with milestone', :feature, :js do ...@@ -48,21 +48,22 @@ describe 'Board with milestone', :feature, :js do
click_link board.name click_link board.name
end end
expect(find('.js-milestone-select')).to have_content(milestone.title) expect(find('.tokens-container')).to have_content(milestone.title)
expect(all('.board')[1]).to have_selector('.card', count: 1) expect(all('.board')[1]).to have_selector('.card', count: 1)
end end
it 'sets board to any milestone' do it 'sets board to any milestone' do
update_board_milestone('Any Milestone') update_board_milestone('Any Milestone')
expect(find('.js-milestone-select')).not_to have_content(milestone.title) expect(page).not_to have_css('.js-visual-token')
expect(find('.tokens-container')).not_to have_content(milestone.title)
expect(all('.board')[1]).to have_selector('.card', count: 2) expect(all('.board')[1]).to have_selector('.card', count: 2)
end end
it 'sets board to upcoming milestone' do it 'sets board to upcoming milestone' do
update_board_milestone('Upcoming') update_board_milestone('Upcoming')
expect(find('.js-milestone-select')).not_to have_content(milestone.title) expect(find('.tokens-container')).not_to have_content(milestone.title)
expect(all('.board')[1]).to have_selector('.card', count: 0) expect(all('.board')[1]).to have_selector('.card', count: 0)
end end
end end
......
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