2019-10-12 21:52:04 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-12-04 20:38:33 +05:30
|
|
|
require 'spec_helper'
|
2016-06-16 23:09:34 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
describe 'Manually create a todo item from issue', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
let!(:project) { create(:project) }
|
|
|
|
let!(:issue) { create(:issue, project: project) }
|
|
|
|
let!(:user) { create(:user)}
|
2016-06-16 23:09:34 +05:30
|
|
|
|
|
|
|
before do
|
2018-11-18 11:00:15 +05:30
|
|
|
project.add_maintainer(user)
|
2017-09-10 17:25:29 +05:30
|
|
|
sign_in(user)
|
|
|
|
visit project_issue_path(project, issue)
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'creates todo when clicking button' do
|
2016-06-16 23:09:34 +05:30
|
|
|
page.within '.issuable-sidebar' do
|
2019-09-30 21:07:59 +05:30
|
|
|
click_button 'Add a To Do'
|
|
|
|
expect(page).to have_content 'Mark as done'
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-16 23:09:34 +05:30
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_issue_path(project, issue)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-22 15:30:34 +05:30
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2016-09-13 17:45:13 +05:30
|
|
|
it 'marks a todo as done' do
|
2016-06-16 23:09:34 +05:30
|
|
|
page.within '.issuable-sidebar' do
|
2019-09-30 21:07:59 +05:30
|
|
|
click_button 'Add a To Do'
|
|
|
|
click_button 'Mark as done'
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
visit project_issue_path(project, issue)
|
2016-06-22 15:30:34 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|