2016-06-07 09:18:57 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-10-03 08:35:01 +00:00
|
|
|
feature 'Manually create a todo item from issue', :js do
|
2017-08-02 19:55:11 +00:00
|
|
|
let!(:project) { create(:project) }
|
2017-07-26 21:49:06 +00:00
|
|
|
let!(:issue) { create(:issue, project: project) }
|
|
|
|
let!(:user) { create(:user)}
|
2016-06-07 09:18:57 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
project.team << [user, :master]
|
2017-06-21 23:44:10 +00:00
|
|
|
sign_in(user)
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_issue_path(project, issue)
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'creates todo when clicking button' do
|
2016-06-07 09:18:57 +00:00
|
|
|
page.within '.issuable-sidebar' do
|
2016-11-23 23:34:58 +00:00
|
|
|
click_button 'Add todo'
|
|
|
|
expect(page).to have_content 'Mark done'
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
|
2017-03-29 21:16:57 +00:00
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-07 09:18:57 +00:00
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-17 08:01:03 +00:00
|
|
|
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_issue_path(project, issue)
|
2016-06-17 08:01:03 +00:00
|
|
|
|
2017-03-29 21:16:57 +00:00
|
|
|
page.within '.header-content .todos-count' do
|
2016-06-17 08:01:03 +00:00
|
|
|
expect(page).to have_content '1'
|
|
|
|
end
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
|
2016-07-25 18:16:19 +00:00
|
|
|
it 'marks a todo as done' do
|
2016-06-07 09:18:57 +00:00
|
|
|
page.within '.issuable-sidebar' do
|
2016-11-23 23:34:58 +00:00
|
|
|
click_button 'Add todo'
|
|
|
|
click_button 'Mark done'
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
|
2017-03-29 21:16:57 +00:00
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-17 08:01:03 +00:00
|
|
|
|
2017-07-06 16:20:50 +00:00
|
|
|
visit project_issue_path(project, issue)
|
2016-06-17 08:01:03 +00:00
|
|
|
|
2017-03-29 21:16:57 +00:00
|
|
|
expect(page).to have_selector('.todos-count', visible: false)
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
end
|