diff options
Diffstat (limited to 'spec/features/task_lists_spec.rb')
-rw-r--r-- | spec/features/task_lists_spec.rb | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/spec/features/task_lists_spec.rb b/spec/features/task_lists_spec.rb index d35726fe125..8a9d2ff42d9 100644 --- a/spec/features/task_lists_spec.rb +++ b/spec/features/task_lists_spec.rb @@ -306,6 +306,12 @@ RSpec.describe 'Task Lists', :js, feature_category: :team_planning do describe 'commented tasks' do let(:commented_tasks_markdown) do <<-EOT.strip_heredoc + <!-- comment text --> + + text + + <!-- - [ ] commented out task --> + <!-- - [ ] a --> @@ -333,6 +339,41 @@ RSpec.describe 'Task Lists', :js, feature_category: :team_planning do expect(page).to have_selector('ul.task-list', count: 1) expect(page).to have_selector('li.task-list-item', count: 1) expect(page).to have_selector('ul input[checked]', count: 1) + expect(page).to have_content('1 of 1 checklist item completed') + end + end + + describe 'tasks in code blocks' do + let(:code_tasks_markdown) do + <<-EOT.strip_heredoc + ``` + - [ ] a + ``` + + - [ ] b + EOT + end + + let!(:issue) { create(:issue, description: code_tasks_markdown, author: user, project: project) } + + it 'renders' do + visit_issue(project, issue) + wait_for_requests + + expect(page).to have_selector('ul.task-list', count: 1) + expect(page).to have_selector('li.task-list-item', count: 1) + expect(page).to have_selector('ul input[checked]', count: 0) + + find('.task-list-item-checkbox').click + wait_for_requests + + visit_issue(project, issue) + wait_for_requests + + expect(page).to have_selector('ul.task-list', count: 1) + expect(page).to have_selector('li.task-list-item', count: 1) + expect(page).to have_selector('ul input[checked]', count: 1) + expect(page).to have_content('1 of 1 checklist item completed') end end @@ -370,6 +411,43 @@ RSpec.describe 'Task Lists', :js, feature_category: :team_planning do end end + describe 'summary properly formatted' do + let(:summary_markdown) do + <<-EOT.strip_heredoc + <details open> + <summary>Valid detail/summary with tasklist</summary> + + - [ ] People Ops: do such and such + + </details> + + * [x] Task 1 + EOT + end + + let!(:issue) { create(:issue, description: summary_markdown, author: user, project: project) } + + it 'renders' do + visit_issue(project, issue) + wait_for_requests + + expect(page).to have_selector('ul.task-list', count: 2) + expect(page).to have_selector('li.task-list-item', count: 2) + expect(page).to have_selector('ul input[checked]', count: 1) + + first('.task-list-item-checkbox').click + wait_for_requests + + visit_issue(project, issue) + wait_for_requests + + expect(page).to have_selector('ul.task-list', count: 2) + expect(page).to have_selector('li.task-list-item', count: 2) + expect(page).to have_selector('ul input[checked]', count: 2) + expect(page).to have_content('2 of 2 checklist items completed') + end + end + describe 'markdown starting with new line character' do let(:markdown_starting_with_new_line) do <<-EOT.strip_heredoc |