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
|
|
|
|
2020-06-23 00:09:42 +05:30
|
|
|
RSpec.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) }
|
2022-08-27 11:52:29 +05:30
|
|
|
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
|
2021-01-03 14:25:43 +05:30
|
|
|
click_button 'Add a to do'
|
2019-09-30 21:07:59 +05:30
|
|
|
expect(page).to have_content 'Mark as done'
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
page.within ".header-content span[aria-label='#{_('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
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
page.within ".header-content span[aria-label='#{_('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
|
2021-01-03 14:25:43 +05:30
|
|
|
click_button 'Add a to do'
|
2019-09-30 21:07:59 +05:30
|
|
|
click_button 'Mark as done'
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
expect(page).to have_selector(".header-content span[aria-label='#{_('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
|
|
|
|
2022-04-04 11:22:00 +05:30
|
|
|
expect(page).to have_selector(".header-content span[aria-label='#{_('Todos count')}']", visible: false)
|
2016-06-16 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|