summaryrefslogtreecommitdiff
path: root/spec/features/todos/todos_spec.rb
diff options
context:
space:
mode:
authorJacopo <beschi.jacopo@gmail.com>2017-03-10 13:31:30 +0100
committerJacopo <beschi.jacopo@gmail.com>2017-03-10 13:37:55 +0100
commite20ffc6e00e917a19fc4b3ee7b0c6ed75c84f001 (patch)
treea01ed46d2b6515308934623388d43e00673eddda /spec/features/todos/todos_spec.rb
parent69c1a9ae868593192d45642d3ad1550e057f877f (diff)
downloadgitlab-ce-e20ffc6e00e917a19fc4b3ee7b0c6ed75c84f001.tar.gz
Add 'Undo' to Todos in the Done tab
Added the ability to 'Undo' the todos marked complete in the 'Done' tab of the Todo dashboard. Added the ability to 'Undo mark all as done' todos marked complete with 'Mark all as done' in the 'Todo' tab of the Todo dashboard.
Diffstat (limited to 'spec/features/todos/todos_spec.rb')
-rw-r--r--spec/features/todos/todos_spec.rb43
1 files changed, 38 insertions, 5 deletions
diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb
index 3495091a0d5..5c2df949ac5 100644
--- a/spec/features/todos/todos_spec.rb
+++ b/spec/features/todos/todos_spec.rb
@@ -38,7 +38,9 @@ describe 'Dashboard Todos', feature: true do
shared_examples 'deleting the todo' do
before do
- first('.js-done-todo').click
+ within first('.todo') do
+ click_link 'Done'
+ end
end
it 'is marked as done-reversible in the list' do
@@ -62,9 +64,11 @@ describe 'Dashboard Todos', feature: true do
shared_examples 'deleting and restoring the todo' do
before do
- first('.js-done-todo').click
- wait_for_ajax
- first('.js-undo-todo').click
+ within first('.todo') do
+ click_link 'Done'
+ wait_for_ajax
+ click_link 'Undo'
+ end
end
it 'is marked back as pending in the list' do
@@ -97,6 +101,35 @@ describe 'Dashboard Todos', feature: true do
end
end
+ context 'User has done todos', js: true do
+ before do
+ create(:todo, :mentioned, :done, user: user, project: project, target: issue, author: author)
+ login_as(user)
+ visit dashboard_todos_path(state: :done)
+ end
+
+ it 'has the done todo present' do
+ expect(page).to have_selector('.todos-list .todo.todo-done', count: 1)
+ end
+
+ describe 'restoring the todo' do
+ before do
+ within first('.todo') do
+ click_link 'Add todo'
+ end
+ end
+
+ it 'is removed from the list' do
+ expect(page).not_to have_selector('.todos-list .todo.todo-done')
+ end
+
+ it 'updates todo count' do
+ expect(page).to have_content 'To do 1'
+ expect(page).to have_content 'Done 0'
+ end
+ end
+ end
+
context 'User has Todos with labels spanning multiple projects' do
before do
label1 = create(:label, project: project)
@@ -143,7 +176,7 @@ describe 'Dashboard Todos', feature: true do
describe 'mark all as done', js: true do
before do
visit dashboard_todos_path
- click_link('Mark all as done')
+ click_link 'Mark all as done'
end
it 'shows "All done" message!' do