Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add spec to ensure toggle all checkbox behavior with empty result filters

Aaron Contrerase70811bcbdc0
diff --git a/spec/features/work_packages/share/filter_spec.rb b/spec/features/work_packages/share/filter_spec.rb
index da7d2602dfc..c39e46d319a 100644
--- a/spec/features/work_packages/share/filter_spec.rb
+++ b/spec/features/work_packages/share/filter_spec.rb
@@ -143,7 +143,7 @@ RSpec.describe 'Work package sharing',
share_modal.expect_shared_with(shared_non_project_group, 'View')
end
- it 'allow to filter for the role' do
+ it 'allows to filter for the role' do
share_modal.expect_open
share_modal.expect_shared_count_of(6)
@@ -192,7 +192,7 @@ RSpec.describe 'Work package sharing',
share_modal.expect_shared_with(shared_non_project_group, 'View')
end
- it 'allow to filter for role and type at the same time' do
+ it 'allows to filter for role and type at the same time' do
share_modal.expect_open
share_modal.expect_shared_count_of(6)
@@ -261,5 +261,17 @@ RSpec.describe 'Work package sharing',
share_modal.expect_shared_with(shared_project_group, 'Edit')
share_modal.expect_shared_with(shared_non_project_group, 'View')
end
+
+ context 'and there are no matching results for my filter' do
+ it 'does not check the "toggle all" checkbox' do
+ share_modal.expect_open
+ share_modal.filter('type', I18n.t('work_package.sharing.filter.not_project_member'))
+ share_modal.filter('role', I18n.t('work_package.sharing.permissions.view'))
+
+ share_modal.expect_blankslate
+ share_modal.expect_shared_count_of(0)
+ share_modal.expect_select_all_untoggled
+ end
+ end
end
end
diff --git a/spec/support/components/work_packages/share_modal.rb b/spec/support/components/work_packages/share_modal.rb
index 0f5fc547f34..f4b1d9375d0 100644
--- a/spec/support/components/work_packages/share_modal.rb
+++ b/spec/support/components/work_packages/share_modal.rb
@@ -136,8 +136,8 @@ module Components
def expect_bulk_actions_not_available
within shares_header do
- expect(page).not_to have_button 'Remove'
- expect(page).not_to have_test_selector('op-share-wp-bulk-update-role')
+ expect(page).not_to have_button('Remove', wait: 0)
+ expect(page).not_to have_test_selector('op-share-wp-bulk-update-role', wait: 0)
end
end