decidim-dev 0.27.9 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/commands/decidim/dummy_resources/create_dummy_resource.rb +0 -1
- data/app/events/decidim/dummy_resources/dummy_resource_event.rb +10 -0
- data/app/jobs/decidim/dummy_resources/hide_all_created_by_author_job.rb +13 -0
- data/app/models/decidim/dummy_resources/application_record.rb +9 -0
- data/app/models/decidim/dummy_resources/coauthorable_dummy_resource.rb +10 -0
- data/app/models/decidim/dummy_resources/dummy_resource.rb +93 -0
- data/app/models/decidim/dummy_resources/nested_dummy_resource.rb +10 -0
- data/app/packs/src/decidim/dev/accessibility.js +3 -3
- data/app/packs/src/decidim/dev/test/custom_map_factory.js +1 -1
- data/app/packs/stylesheets/decidim/dev/_accessibility.scss +24 -24
- data/app/packs/stylesheets/decidim/dev/_map.scss +10 -0
- data/app/packs/stylesheets/decidim/dev.scss +1 -0
- data/app/presenters/decidim/dummy_resources/official_author_presenter.rb +33 -0
- data/app/serializers/decidim/dummy_resources/dummy_serializer.rb +21 -0
- data/app/views/decidim/dummy_resources/dummy_resources/show.html.erb +22 -12
- data/config/locales/ar.yml +0 -1
- data/config/locales/bg.yml +0 -9
- data/config/locales/de.yml +1 -1
- data/config/locales/el.yml +0 -1
- data/config/locales/en.yml +1 -1
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es-PY.yml +1 -1
- data/config/locales/eu.yml +3 -3
- data/config/locales/gl.yml +0 -1
- data/config/locales/hu.yml +2 -3
- data/config/locales/id-ID.yml +0 -1
- data/config/locales/it.yml +0 -1
- data/config/locales/lv.yml +0 -1
- data/config/locales/nl.yml +0 -1
- data/config/locales/no.yml +0 -1
- data/config/locales/pl.yml +0 -9
- data/config/locales/pt-BR.yml +0 -9
- data/config/locales/pt.yml +0 -1
- data/config/locales/ru.yml +0 -1
- data/config/locales/sk.yml +0 -1
- data/config/locales/sv.yml +1 -2
- data/config/locales/tr-TR.yml +0 -1
- data/config/locales/zh-CN.yml +0 -1
- data/config/rubocop/disabled.yml +11 -0
- data/config/rubocop/faker.yml +480 -0
- data/config/rubocop/rails.yml +105 -0
- data/config/rubocop/rspec.yml +69 -0
- data/config/rubocop/ruby.yml +1207 -0
- data/lib/decidim/dev/assets/import_participatory_space_private_users.csv +2 -2
- data/lib/decidim/dev/assets/import_participatory_space_private_users_invalid_col_sep.csv +2 -0
- data/lib/decidim/dev/assets/import_participatory_space_private_users_nok.csv +2 -2
- data/lib/decidim/dev/assets/import_participatory_space_private_users_with_bom.csv +1 -1
- data/lib/decidim/dev/assets/iso-8859-15.md +1 -1
- data/lib/decidim/dev/assets/participatory_text.md +4 -2
- data/lib/decidim/dev/assets/verify_user_groups.csv +22 -22
- data/lib/decidim/dev/engine.rb +4 -3
- data/lib/decidim/dev/test/factories.rb +3 -5
- data/lib/decidim/dev/test/form_to_param_shared_examples.rb +1 -1
- data/lib/decidim/dev/test/promoted_participatory_processes_shared_examples.rb +9 -9
- data/lib/decidim/dev/test/rspec_support/accessibility_examples.rb +119 -1
- data/lib/decidim/dev/test/rspec_support/attachment_helpers.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/bullet.rb +32 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +26 -25
- data/lib/decidim/dev/test/rspec_support/cell_matchers.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/component.rb +1 -311
- data/lib/decidim/dev/test/rspec_support/component_context.rb +10 -10
- data/lib/decidim/dev/test/rspec_support/confirmation_helpers.rb +18 -14
- data/lib/decidim/dev/test/rspec_support/data_consent.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/dynamic_attach.rb +19 -4
- data/lib/decidim/dev/test/rspec_support/editor_context.rb +35 -0
- data/lib/decidim/dev/test/rspec_support/engine_examples.rb +15 -0
- data/lib/decidim/dev/test/rspec_support/filters.rb +11 -0
- data/lib/decidim/dev/test/rspec_support/forms_validations.rb +20 -0
- data/lib/decidim/dev/test/rspec_support/geocoder.rb +3 -3
- data/lib/decidim/dev/test/rspec_support/helpers.rb +187 -34
- data/lib/decidim/dev/test/rspec_support/imports_controller_shared_examples.rb +11 -11
- data/lib/decidim/dev/test/rspec_support/tom_select.rb +26 -0
- data/lib/decidim/dev/test/rspec_support/translation_helpers.rb +8 -8
- data/lib/decidim/dev/test/rspec_support/warden.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/webmock.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/webpacker.rb +4 -22
- data/lib/decidim/dev/test/spec_helper.rb +14 -3
- data/lib/decidim/dev/test/w3c_rspec_validators_overrides.rb +1 -5
- data/lib/decidim/dev/version.rb +1 -1
- data/lib/decidim/dev.rb +9 -0
- data/lib/decidim/dummy_resources/admin.rb +8 -0
- data/lib/decidim/dummy_resources/admin_engine.rb +43 -0
- data/lib/decidim/dummy_resources/component.rb +94 -0
- data/lib/decidim/dummy_resources/engine.rb +28 -0
- data/lib/decidim/dummy_resources.rb +20 -0
- data/lib/tasks/lighthouse_report.rake +29 -7
- data/rubocop-decidim.yml +13 -0
- metadata +117 -93
- data/config/locales/he-IL.yml +0 -1
- data/decidim-dev.gemspec +0 -58
- data/lib/decidim/dev/test/rspec_support/capybara_data_picker.rb +0 -36
- data/lib/decidim/dev/test/rspec_support/capybara_scopes_picker.rb +0 -92
- data/lib/decidim/dev/test/rspec_support/concurrency.rb +0 -23
- data/lib/decidim/dev/test/rspec_support/decidim_sanitization.rb +0 -5
@@ -1,92 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "capybara_data_picker"
|
4
|
-
|
5
|
-
module Capybara
|
6
|
-
module ScopesPicker
|
7
|
-
include DataPicker
|
8
|
-
|
9
|
-
RSpec::Matchers.define :have_scope_picked do |expected|
|
10
|
-
match do |scope_picker|
|
11
|
-
data_picker = scope_picker.data_picker
|
12
|
-
scope_name = expected ? translated(expected.name) : t("decidim.scopes.global")
|
13
|
-
|
14
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible: :all)
|
15
|
-
expect(data_picker).to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{scope_name}')]]")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
RSpec::Matchers.define :have_scope_not_picked do |expected|
|
20
|
-
match do |scope_picker|
|
21
|
-
data_picker = scope_picker.data_picker
|
22
|
-
scope_name = expected ? translated(expected.name) : t("decidim.scopes.global")
|
23
|
-
expect(data_picker).not_to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible: :all)
|
24
|
-
expect(data_picker).not_to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{scope_name}')]]")
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def scope_pick(scope_picker, scope)
|
29
|
-
data_picker = scope_picker.data_picker
|
30
|
-
# use scope_repick to change single scope picker selected scope
|
31
|
-
expect(data_picker).to have_selector(".picker-values:empty", visible: :all) if data_picker.has_css?(".picker-single")
|
32
|
-
|
33
|
-
expect(data_picker).to have_selector(".picker-prompt")
|
34
|
-
data_picker.find(".picker-prompt").click
|
35
|
-
|
36
|
-
scope_picker_browse_scopes(scope.part_of_scopes) if scope
|
37
|
-
data_picker_pick_current
|
38
|
-
|
39
|
-
expect(scope_picker).to have_scope_picked(scope)
|
40
|
-
end
|
41
|
-
|
42
|
-
def scope_repick(element_id, old_scope, new_scope)
|
43
|
-
scope_picker = select_data_picker(element_id)
|
44
|
-
|
45
|
-
data_picker = scope_picker.data_picker
|
46
|
-
|
47
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{old_scope&.id || scope_picker.global_value}']", visible: :all)
|
48
|
-
data_picker.find(:xpath, "//div[contains(@class,'picker-values')]/div/input[@value='#{old_scope&.id || scope_picker.global_value}']/../a").click
|
49
|
-
|
50
|
-
# browse to lowest common parent between old and new scope
|
51
|
-
parent_scope = (old_scope.part_of_scopes & new_scope.part_of_scopes).last
|
52
|
-
|
53
|
-
scope_picker_browse_scope(parent_scope, back: true)
|
54
|
-
scope_picker_browse_scopes(new_scope.part_of_scopes - old_scope.part_of_scopes)
|
55
|
-
data_picker_pick_current
|
56
|
-
|
57
|
-
scope_picker = select_data_picker(element_id)
|
58
|
-
|
59
|
-
expect(scope_picker).to have_scope_picked(new_scope)
|
60
|
-
end
|
61
|
-
|
62
|
-
def scope_unpick(scope_picker, scope)
|
63
|
-
data_picker = scope_picker.data_picker
|
64
|
-
|
65
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']", visible: :all)
|
66
|
-
data_picker.find(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']").click
|
67
|
-
|
68
|
-
expect(scope_picker).to have_scope_not_picked(scope)
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
|
73
|
-
def scope_picker_browse_scopes(scopes)
|
74
|
-
scopes.each do |scope|
|
75
|
-
scope_picker_browse_scope(scope)
|
76
|
-
sleep(2)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def scope_picker_browse_scope(scope, back: false)
|
81
|
-
body = find(:xpath, "//body")
|
82
|
-
where = back ? "header" : "content"
|
83
|
-
scope_name = scope ? translated(scope.name) : t("decidim.scopes.global")
|
84
|
-
expect(body).to have_selector("#data_picker-modal .picker-#{where} a", text: scope_name)
|
85
|
-
body.find("#data_picker-modal .picker-#{where} a", text: scope_name).click
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
RSpec.configure do |config|
|
91
|
-
config.include Capybara::ScopesPicker, type: :system
|
92
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Note that RSpec also provides `uses_transaction` but it needs to be specific
|
4
|
-
# with the name of the method which can easily break and the concurrency tests
|
5
|
-
# will anyways pass when run with the transactional mode. We want the same
|
6
|
-
# database to be used without transactions during the tests so that we can test
|
7
|
-
# concurrency correctly.
|
8
|
-
RSpec.shared_context "with concurrency" do
|
9
|
-
self.use_transactional_tests = false
|
10
|
-
|
11
|
-
after do
|
12
|
-
# Because the transactional tests are disabled, we need to manually clear
|
13
|
-
# the tables after the test.
|
14
|
-
connection = ActiveRecord::Base.connection
|
15
|
-
connection.disable_referential_integrity do
|
16
|
-
connection.tables.each do |table_name|
|
17
|
-
next if connection.select_value("SELECT COUNT(*) FROM #{table_name}").zero?
|
18
|
-
|
19
|
-
connection.execute("TRUNCATE #{table_name} CASCADE")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|