diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2017-01-29 10:44:30 +0100 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2017-03-16 07:15:00 +0100 |
commit | 5f9ace8eb1d71b35c92156177465b066ebbc4a3e (patch) | |
tree | 5af8e80ecace78f4d165cb470062e6a2cd53c853 /spec/features/todos | |
parent | 5e05d6b8cf26c424378ef6091a4b38c2d424808e (diff) | |
download | gitlab-ce-5f9ace8eb1d71b35c92156177465b066ebbc4a3e.tar.gz |
Add 'Undo mark all as done' to Todos
Added the ability to 'Undo mark all as done' todos marked as complete with 'Mark all as done'
in the 'Todo' tab of the Todo dashboard.
The operation undos only the todo previously marked as done with the 'Mark al as done' button.
Diffstat (limited to 'spec/features/todos')
-rw-r--r-- | spec/features/todos/todos_spec.rb | 56 |
1 files changed, 55 insertions, 1 deletions
diff --git a/spec/features/todos/todos_spec.rb b/spec/features/todos/todos_spec.rb index 5c2df949ac5..850020109d4 100644 --- a/spec/features/todos/todos_spec.rb +++ b/spec/features/todos/todos_spec.rb @@ -31,7 +31,7 @@ describe 'Dashboard Todos', feature: true do end it 'shows due date as today' do - page.within first('.todo') do + within first('.todo') do expect(page).to have_content 'Due today' end end @@ -184,6 +184,60 @@ describe 'Dashboard Todos', feature: true do expect(page).to have_content "You're all done!" expect(page).not_to have_selector('.gl-pagination') end + + it 'shows "Undo mark all as done" button' do + expect(page).to have_selector('.js-todos-mark-all', visible: false) + expect(page).to have_selector('.js-todos-undo-all', visible: true) + end + end + + describe 'undo mark all as done', js: true do + before do + visit dashboard_todos_path + end + + it 'shows the restored todo list' do + mark_all_and_undo + + expect(page).to have_selector('.todos-list .todo', count: 1) + expect(page).to have_selector('.gl-pagination') + expect(page).not_to have_content "You're all done!" + end + + it 'updates todo count' do + mark_all_and_undo + + expect(page).to have_content 'To do 2' + expect(page).to have_content 'Done 0' + end + + it 'shows "Mark all as done" button' do + mark_all_and_undo + + expect(page).to have_selector('.js-todos-mark-all', visible: true) + expect(page).to have_selector('.js-todos-undo-all', visible: false) + end + + context 'User has deleted a todo' do + before do + within first('.todo') do + click_link 'Done' + end + end + + it 'shows the restored todo list with the deleted todo' do + mark_all_and_undo + + expect(page).to have_selector('.todos-list .todo.todo-pending', count: 1) + end + end + + def mark_all_and_undo + click_link 'Mark all as done' + wait_for_ajax + click_link 'Undo mark all as done' + wait_for_ajax + end end end |