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

Dynamically set the bold keystroke based on the underlying platform

Aaron Contreras8b65c9e2972e
diff --git a/spec/features/wysiwyg/non_breaking_spaces_spec.rb b/spec/features/wysiwyg/non_breaking_spaces_spec.rb
index 75b79b3ebe4..2f5af726098 100644
--- a/spec/features/wysiwyg/non_breaking_spaces_spec.rb
+++ b/spec/features/wysiwyg/non_breaking_spaces_spec.rb
@@ -36,6 +36,18 @@ RSpec.describe 'Wysiwyg bold behavior',
let(:project) { create(:project, enabled_module_names: %w[wiki]) }
let(:editor) { Components::WysiwygEditor.new }
+ def mac_osx?
+ RUBY_PLATFORM.include?('darwin')
+ end
+
+ def bold_keystroke
+ if mac_osx?
+ [:meta, 'b']
+ else
+ [:ctrl, 'b']
+ end
+ end
+
describe 'in wikis' do
describe 'creating a wiki page' do
before do
@@ -43,7 +55,7 @@ RSpec.describe 'Wysiwyg bold behavior',
end
it 'can insert strong formatting with nbsp' do
- editor.click_and_type_slowly 'some text ', [:meta, 'b'], 'with bold'
+ editor.click_and_type_slowly 'some text ', bold_keystroke, 'with bold'
# Save wiki page
click_on 'Save'