decidim-dev 0.26.8 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/dummy_resources/create_dummy_resource.rb +1 -1
  3. data/app/controllers/concerns/decidim/dev/needs_development_tools.rb +1 -1
  4. data/config/assets.rb +1 -2
  5. data/config/locales/am-ET.yml +1 -0
  6. data/config/locales/ar.yml +1 -18
  7. data/config/locales/bg.yml +1 -0
  8. data/config/locales/ca.yml +1 -6
  9. data/config/locales/cs.yml +1 -6
  10. data/config/locales/da.yml +1 -0
  11. data/config/locales/de.yml +1 -8
  12. data/config/locales/el.yml +1 -0
  13. data/config/locales/en.yml +0 -6
  14. data/config/locales/eo.yml +1 -0
  15. data/config/locales/es-MX.yml +1 -6
  16. data/config/locales/es-PY.yml +1 -6
  17. data/config/locales/es.yml +1 -6
  18. data/config/locales/et.yml +1 -0
  19. data/config/locales/eu.yml +1 -0
  20. data/config/locales/fi-plain.yml +1 -6
  21. data/config/locales/fi.yml +1 -6
  22. data/config/locales/fr-CA.yml +1 -6
  23. data/config/locales/fr.yml +1 -6
  24. data/config/locales/ga-IE.yml +1 -0
  25. data/config/locales/gl.yml +1 -0
  26. data/config/locales/hr.yml +1 -0
  27. data/config/locales/hu.yml +1 -0
  28. data/config/locales/id-ID.yml +1 -0
  29. data/config/locales/is-IS.yml +2 -1
  30. data/config/locales/it.yml +1 -0
  31. data/config/locales/ja.yml +1 -6
  32. data/config/locales/ko.yml +1 -0
  33. data/config/locales/lb.yml +1 -0
  34. data/config/locales/lt.yml +1 -63
  35. data/config/locales/lv.yml +1 -0
  36. data/config/locales/mt.yml +1 -0
  37. data/config/locales/nl.yml +1 -0
  38. data/config/locales/no.yml +1 -0
  39. data/config/locales/om-ET.yml +1 -0
  40. data/config/locales/pl.yml +1 -0
  41. data/config/locales/pt-BR.yml +2 -1
  42. data/config/locales/pt.yml +1 -0
  43. data/config/locales/ro-RO.yml +1 -6
  44. data/config/locales/ru.yml +1 -0
  45. data/config/locales/si-LK.yml +1 -0
  46. data/config/locales/sk.yml +1 -0
  47. data/config/locales/sl.yml +1 -0
  48. data/config/locales/so-SO.yml +1 -0
  49. data/config/locales/sr-CS.yml +1 -0
  50. data/config/locales/sv.yml +1 -1
  51. data/config/locales/sw-KE.yml +1 -0
  52. data/config/locales/ti-ER.yml +1 -0
  53. data/config/locales/tr-TR.yml +1 -0
  54. data/config/locales/uk.yml +1 -0
  55. data/config/locales/val-ES.yml +1 -0
  56. data/config/locales/vi.yml +1 -0
  57. data/config/locales/zh-CN.yml +1 -0
  58. data/config/locales/zh-TW.yml +1 -63
  59. data/lib/decidim/dev/assets/assemblies.json +1 -11
  60. data/lib/decidim/dev/assets/geocoder_result_here.json +46 -67
  61. data/lib/decidim/dev/assets/logo.png +0 -0
  62. data/lib/decidim/dev/common_rake.rb +1 -0
  63. data/lib/decidim/dev/railtie.rb +1 -1
  64. data/lib/decidim/dev/test/base_spec_helper.rb +2 -1
  65. data/lib/decidim/dev/test/rspec_support/accessibility_examples.rb +1 -3
  66. data/lib/decidim/dev/test/rspec_support/attachment_helpers.rb +30 -0
  67. data/lib/decidim/dev/test/rspec_support/autocomplete_select.rb +23 -0
  68. data/lib/decidim/dev/test/rspec_support/capybara.rb +43 -5
  69. data/lib/decidim/dev/test/rspec_support/comments.rb +1 -1
  70. data/lib/decidim/dev/test/rspec_support/component.rb +5 -5
  71. data/lib/decidim/dev/test/rspec_support/component_context.rb +0 -20
  72. data/lib/decidim/dev/test/rspec_support/controller_example_group.rb +27 -0
  73. data/lib/decidim/dev/test/rspec_support/cookies.rb +41 -0
  74. data/lib/decidim/dev/test/rspec_support/dynamic_attach.rb +31 -0
  75. data/lib/decidim/dev/test/rspec_support/frontend.rb +1 -1
  76. data/lib/decidim/dev/test/rspec_support/geocoder.rb +6 -2
  77. data/lib/decidim/dev/test/rspec_support/helpers.rb +0 -12
  78. data/lib/decidim/dev/test/rspec_support/html_matchers.rb +11 -0
  79. data/lib/decidim/dev/test/rspec_support/imports_controller_shared_examples.rb +3 -8
  80. data/lib/decidim/dev/test/rspec_support/network_conditions_helpers.rb +18 -0
  81. data/lib/decidim/dev/test/rspec_support/rake_tasks.rb +0 -2
  82. data/lib/decidim/dev/test/rspec_support/screenshot_helper.rb +41 -0
  83. data/lib/decidim/dev/test/rspec_support/warden.rb +5 -0
  84. data/lib/decidim/dev/test/rspec_support/wicked_pdf_assets_mock.rb +4 -0
  85. data/lib/decidim/dev/test/spec_helper.rb +2 -4
  86. data/lib/decidim/dev/test/w3c_rspec_validators_overrides.rb +0 -2
  87. data/lib/decidim/dev/version.rb +1 -1
  88. data/lib/decidim-dev.rb +1 -1
  89. data/lib/tasks/generators.rake +6 -2
  90. data/lib/tasks/lighthouse_report.rake +29 -0
  91. data/lib/tasks/locale_checker.rake +1 -1
  92. metadata +48 -53
  93. data/app/packs/entrypoints/decidim_dev_test_custom_map.js +0 -1
  94. data/app/packs/src/decidim/dev/test/custom_map_factory.js +0 -55
  95. data/config/environment.rb +0 -0
  96. data/config/locales/fa-IR.yml +0 -1
  97. data/config/locales/gn-PY.yml +0 -1
  98. data/config/locales/ka-GE.yml +0 -1
  99. data/config/locales/kaa.yml +0 -1
  100. data/config/locales/lo-LA.yml +0 -1
  101. data/config/locales/oc-FR.yml +0 -1
  102. data/lib/decidim/dev/test/rspec_support/react_select.rb +0 -29
  103. data/lib/decidim/dev/test/rspec_support/summary_notification.rb +0 -51
  104. data/lib/rubocop/cop/decidim/hash_shorthand_syntax_backports.rb +0 -175
  105. data/lib/rubocop/cop/decidim.rb +0 -9
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Adapted from https://github.com/JedWatson/react-select/issues/832#issuecomment-276441836
4
-
5
- module Capybara
6
- module ReactSelect
7
- def autocomplete_select(value, from:)
8
- within("div[data-autocomplete-for='#{from}']") do
9
- find(".Select-control").click
10
-
11
- find(".Select .Select-input input").native.send_keys(value[0..4])
12
- expect(page).to have_css(".Select-menu-outer") # select should be open now
13
-
14
- # This is a little funky because when the entered text forces the select to
15
- # wrap, it causes React to re-render. We need to get it to re-render
16
- # (if needed) by hovering.
17
- expect(page).to have_css(".Select-option", text: value)
18
- find(".Select-option", text: value).hover
19
- expect(page).to have_css(".Select-option", text: value)
20
- find(".Select-option", text: value).click
21
- expect(page).to have_css(".Select-value-label", text: value)
22
- end
23
- end
24
- end
25
- end
26
-
27
- RSpec.configure do |config|
28
- config.include Capybara::ReactSelect, type: :system
29
- end
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module RSpec::Core
4
- module Notifications
5
- class SummaryNotification
6
- # Override the original method to add the full path to the spec file and the correct rspec command to rerun the failed spec
7
- # The goal is to be able to copy-paste the command to rerun the failed spec without having to manually add the full path to the spec file
8
- #
9
- # So, instead of:
10
- # > rspec ./spec/system/registration_spec.rb:27
11
- #
12
- # We get:
13
- # > bin/rspec ./decidim-core/spec/system/registration_spec.rb:27
14
- #
15
- # Original code in rspec-core: https://github.com/rspec/rspec-core/blob/8caecca0b9b299ccbaa5c7ea5dd885ab42cd57d3/lib/rspec/core/notifications.rb#L365
16
- def colorized_rerun_commands(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
17
- rspec_command = running_with_rspec_wrapper? ? "bin/rspec" : "rspec"
18
- "\nFailed examples:\n\n" +
19
- failed_examples.map do |example|
20
- colorizer.wrap("#{rspec_command} #{rerun_argument_for(example)}", RSpec.configuration.failure_color) + " " +
21
- colorizer.wrap("# #{example.full_description}", RSpec.configuration.detail_color)
22
- end.join("\n")
23
- end
24
-
25
- private
26
-
27
- def running_with_rspec_wrapper?
28
- $0 == "bin/rspec"
29
- end
30
-
31
- def rerun_argument_for(example)
32
- if running_with_rspec_wrapper?
33
- location = location_rerun_argument_for_decidim(example)
34
- else
35
- location = example.location_rerun_argument
36
- end
37
- return location unless duplicate_rerun_locations.include?(location)
38
-
39
- conditionally_quote(example.id)
40
- end
41
-
42
- def location_rerun_argument_for_decidim(example)
43
- absolute_file_path = example.metadata[:absolute_file_path]
44
- file_path = example.metadata[:file_path][1..-1]
45
- module_dir = absolute_file_path.gsub(file_path, "").split("/")[-1]
46
-
47
- "./#{module_dir}#{file_path}:#{example.metadata[:line_number]}"
48
- end
49
- end
50
- end
51
- end
@@ -1,175 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Originally copied from https://github.com/koic/rubocop/blob/master/lib/rubocop/cop/mixin/hash_shorthand_syntax.rb
5
- # Copyright (c) 2012-22 Bozhidar Batsov
6
- # MIT License
7
- #
8
-
9
- module RuboCop
10
- module Cop
11
- # This module checks for Ruby 3.1's hash value omission syntax.
12
- #
13
- # For using this on Decidim, we have added the Decidim namespace and also the Backports prefix
14
- # to the module name
15
- module Decidim
16
- module HashShorthandSyntaxBackports
17
- OMIT_HASH_VALUE_MSG = "Omit the hash value."
18
- EXPLICIT_HASH_VALUE_MSG = "Include the hash value."
19
- DO_NOT_MIX_MSG_PREFIX = "Do not mix explicit and implicit hash values."
20
- DO_NOT_MIX_OMIT_VALUE_MSG = "#{DO_NOT_MIX_MSG_PREFIX} #{OMIT_HASH_VALUE_MSG}".freeze
21
- DO_NOT_MIX_EXPLICIT_VALUE_MSG = "#{DO_NOT_MIX_MSG_PREFIX} #{EXPLICIT_HASH_VALUE_MSG}".freeze
22
-
23
- def on_hash_for_mixed_shorthand(hash_node)
24
- return if ignore_mixed_hash_shorthand_syntax?(hash_node)
25
-
26
- hash_value_type_breakdown = breakdown_value_types_of_hash(hash_node)
27
-
28
- if hash_with_mixed_shorthand_syntax?(hash_value_type_breakdown)
29
- mixed_shorthand_syntax_check(hash_value_type_breakdown)
30
- else
31
- no_mixed_shorthand_syntax_check(hash_value_type_breakdown)
32
- end
33
- end
34
-
35
- def on_pair(node)
36
- return if ignore_hash_shorthand_syntax?(node)
37
-
38
- hash_key_source = node.key.source
39
-
40
- if enforced_shorthand_syntax == "always"
41
- return if node.value_omission? || require_hash_value?(hash_key_source, node)
42
-
43
- message = OMIT_HASH_VALUE_MSG
44
- replacement = "#{hash_key_source}:"
45
- self.config_to_allow_offenses = { "Enabled" => false }
46
- else
47
- return unless node.value_omission?
48
-
49
- message = EXPLICIT_HASH_VALUE_MSG
50
- replacement = "#{hash_key_source}: #{hash_key_source}"
51
- end
52
-
53
- register_offense(node, message, replacement)
54
- end
55
-
56
- private
57
-
58
- def register_offense(node, message, replacement)
59
- add_offense(node.value, message:) do |corrector|
60
- corrector.replace(node, replacement)
61
- end
62
- end
63
-
64
- def ignore_mixed_hash_shorthand_syntax?(hash_node)
65
- target_ruby_version <= 3.0 || enforced_shorthand_syntax != "consistent" ||
66
- !hash_node.hash_type?
67
- end
68
-
69
- def ignore_hash_shorthand_syntax?(pair_node)
70
- target_ruby_version <= 3.0 || enforced_shorthand_syntax == "either" ||
71
- enforced_shorthand_syntax == "consistent" ||
72
- !pair_node.parent.hash_type?
73
- end
74
-
75
- def enforced_shorthand_syntax
76
- cop_config.fetch("EnforcedShorthandSyntax", "always")
77
- end
78
-
79
- def require_hash_value?(hash_key_source, node)
80
- return true if !node.key.sym_type? || require_hash_value_for_around_hash_literal?(node)
81
-
82
- hash_value = node.value
83
- return true unless hash_value.send_type? || hash_value.lvar_type?
84
-
85
- hash_key_source != hash_value.source || hash_key_source.end_with?("!", "?")
86
- end
87
-
88
- def require_hash_value_for_around_hash_literal?(node)
89
- return false unless (ancestor = node.parent.parent)
90
- return false if ancestor.send_type? && ancestor.method?(:[])
91
-
92
- !node.parent.braces? && !use_element_of_hash_literal_as_receiver?(ancestor, node.parent) &&
93
- (use_modifier_form_without_parenthesized_method_call?(ancestor) ||
94
- without_parentheses_call_expr_follows?(ancestor))
95
- end
96
-
97
- def use_element_of_hash_literal_as_receiver?(ancestor, parent)
98
- # `{value:}.do_something` is a valid syntax.
99
- ancestor.send_type? && ancestor.receiver == parent
100
- end
101
-
102
- def use_modifier_form_without_parenthesized_method_call?(ancestor)
103
- return false if ancestor.respond_to?(:parenthesized?) && ancestor.parenthesized?
104
-
105
- ancestor.ancestors.any? { |node| node.respond_to?(:modifier_form?) && node.modifier_form? }
106
- end
107
-
108
- def without_parentheses_call_expr_follows?(ancestor)
109
- return false unless ancestor.respond_to?(:parenthesized?) && !ancestor.parenthesized?
110
-
111
- right_sibling = ancestor.right_sibling
112
- right_sibling ||= ancestor.each_ancestor.find do |node|
113
- node.assignment? || node.send_type?
114
- end&.right_sibling
115
-
116
- !!right_sibling
117
- end
118
-
119
- def breakdown_value_types_of_hash(hash_node)
120
- hash_node.pairs.group_by do |pair_node|
121
- if pair_node.value_omission?
122
- :value_omitted
123
- elsif require_hash_value?(pair_node.key.source, pair_node)
124
- :value_needed
125
- else
126
- :value_omittable
127
- end
128
- end
129
- end
130
-
131
- def hash_with_mixed_shorthand_syntax?(hash_value_type_breakdown)
132
- hash_value_type_breakdown.keys.size > 1
133
- end
134
-
135
- def hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown)
136
- hash_value_type_breakdown[:value_needed]&.any?
137
- end
138
-
139
- def each_omitted_value_pair(hash_value_type_breakdown, &)
140
- hash_value_type_breakdown[:value_omitted]&.each(&)
141
- end
142
-
143
- def each_omittable_value_pair(hash_value_type_breakdown, &)
144
- hash_value_type_breakdown[:value_omittable]&.each(&)
145
- end
146
-
147
- def mixed_shorthand_syntax_check(hash_value_type_breakdown)
148
- if hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown)
149
- each_omitted_value_pair(hash_value_type_breakdown) do |pair_node|
150
- hash_key_source = pair_node.key.source
151
- replacement = "#{hash_key_source}: #{hash_key_source}"
152
- register_offense(pair_node, DO_NOT_MIX_EXPLICIT_VALUE_MSG, replacement)
153
- end
154
- else
155
- each_omittable_value_pair(hash_value_type_breakdown) do |pair_node|
156
- hash_key_source = pair_node.key.source
157
- replacement = "#{hash_key_source}:"
158
- register_offense(pair_node, DO_NOT_MIX_OMIT_VALUE_MSG, replacement)
159
- end
160
- end
161
- end
162
-
163
- def no_mixed_shorthand_syntax_check(hash_value_type_breakdown)
164
- return if hash_with_values_that_cant_be_omitted?(hash_value_type_breakdown)
165
-
166
- each_omittable_value_pair(hash_value_type_breakdown) do |pair_node|
167
- hash_key_source = pair_node.key.source
168
- replacement = "#{hash_key_source}:"
169
- register_offense(pair_node, OMIT_HASH_VALUE_MSG, replacement)
170
- end
171
- end
172
- end
173
- end
174
- end
175
- end
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rubocop
4
- module Cop
5
- class Decidim < Base
6
- include HashShortandSyntaxBacports
7
- end
8
- end
9
- end