Commit c85df550 authored by Phil Hughes's avatar Phil Hughes Committed by Douglas Barbosa Alexandre

Added feature tests

parent c4c6f85f
......@@ -72,11 +72,11 @@ const boardMilestoneSelect = require('./milestone_select');
if (this.currentBoard && this.currentPage !== 'new') {
this.currentBoard.name = this.board.name;
if (this.board.milestone_id) {
if (this.board.milestone) {
this.currentBoard.milestone_id = this.board.milestone_id;
this.currentBoard.milestone = this.board.milestone;
Store.state.filters.milestone_title = this.currentBoard.milestone.title;
Store.state.filters.milestone_title = this.currentBoard.milestone_id ? this.currentBoard.milestone.title : null;
}
}
......
......@@ -96,7 +96,7 @@ require('./board_new_form');
},
updateMilestoneFilterDropdown() {
const $milestoneDropdown = $('.dropdown-menu-milestone');
const hideElements = this.board.milestone_id === null;
const hideElements = this.board.milestone_id === null || this.board.milestone_id === -1;
$milestoneDropdown.find('.dropdown-input, .dropdown-footer-list')
.toggle(hideElements);
......
......@@ -18,9 +18,9 @@ module.exports = Vue.extend({
return {
loading: false,
milestones: [],
noMilestone: {
id: -1,
title: 'No Milestone',
anyMilestone: {
id: null,
title: 'Any Milestone',
},
};
},
......@@ -45,11 +45,11 @@ module.exports = Vue.extend({
<li>
<a
href="#"
@click.prevent.stop="selectMilestone(noMilestone)">
@click.prevent.stop="selectMilestone(anyMilestone)">
<i
class="fa fa-check"
v-if="board.milestone_id === noMilestone.id"></i>
{{ noMilestone.title }}
v-if="board.milestone_id === anyMilestone.id"></i>
{{ anyMilestone.title }}
</a>
</li>
<li class="divider"></li>
......
require 'rails_helper'
describe 'Multiple Issue Boards', :feature, :js do
include WaitForAjax
include WaitForVueResource
let(:user) { create(:user) }
let(:project) { create(:empty_project, :public) }
let!(:milestone) { create(:milestone, project: project) }
let!(:issue) { create(:closed_issue, project: project) }
let!(:issue_milestone) { create(:closed_issue, project: project, milestone: milestone) }
before do
project.team << [user, :master]
login_as(user)
end
context 'new board' do
before do
visit namespace_project_boards_path(project.namespace, project)
end
it 'creates board with milestone' do
create_board_with_milestone
click_link 'test'
expect(find('.js-milestone-select')).to have_content(milestone.title)
expect(all('.board')[1]).to have_selector('.card', count: 1)
end
end
context 'update board' do
let!(:milestone_two) { create(:milestone, project: project) }
let!(:board) { create(:board, project: project, milestone: milestone) }
before do
visit namespace_project_boards_path(project.namespace, project)
end
it 'defaults milestone filter' do
page.within '#js-multiple-boards-switcher' do
find('.dropdown-menu-toggle').click
wait_for_vue_resource
click_link board.name
end
expect(find('.js-milestone-select')).to have_content(milestone.title)
expect(all('.board')[1]).to have_selector('.card', count: 1)
end
it 'sets board to any milestone' do
update_board_milestone('Any Milestone')
expect(find('.js-milestone-select')).not_to have_content(milestone.title)
expect(all('.board')[1]).to have_selector('.card', count: 2)
end
end
def create_board_with_milestone
page.within '#js-multiple-boards-switcher' do
find('.dropdown-menu-toggle').click
click_link 'Create new board'
find('#board-new-name').set 'test'
click_button 'Milestone'
click_link milestone.title
click_button 'Create'
end
end
def update_board_milestone(milestone_title)
page.within '#js-multiple-boards-switcher' do
find('.dropdown-menu-toggle').click
click_link 'Edit board milestone'
click_link milestone_title
click_button 'Save'
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