2019-07-25 05:24:42 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 07:56:52 +00:00
|
|
|
require 'spec_helper'
|
2016-06-07 09:18:57 +00:00
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
RSpec.describe '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
|
2018-07-11 14:36:08 +00:00
|
|
|
project.add_maintainer(user)
|
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
|
2020-10-08 09:08:40 +00:00
|
|
|
click_button 'Add a to do'
|
2019-07-04 15:45:54 +00:00
|
|
|
expect(page).to have_content 'Mark as done'
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
|
2022-02-07 15:15:53 +00:00
|
|
|
page.within ".header-content span[aria-label='#{_('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
|
|
|
|
2022-02-07 15:15:53 +00:00
|
|
|
page.within ".header-content span[aria-label='#{_('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
|
2020-10-08 09:08:40 +00:00
|
|
|
click_button 'Add a to do'
|
2019-07-04 15:45:54 +00:00
|
|
|
click_button 'Mark as done'
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
|
2022-02-07 15:15:53 +00:00
|
|
|
expect(page).to have_selector(".header-content span[aria-label='#{_('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
|
|
|
|
2022-02-07 15:15:53 +00:00
|
|
|
expect(page).to have_selector(".header-content span[aria-label='#{_('Todos count')}']", visible: false)
|
2016-06-07 09:18:57 +00:00
|
|
|
end
|
|
|
|
end
|