decidim-dev 0.19.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/images/decidim/dummy.svg +1 -4
- data/app/assets/images/decidim/gamification/badges/test.svg +1 -145
- data/app/commands/decidim/dummy_resources/create_dummy_resource.rb +48 -0
- data/app/forms/decidim/dummy_resources/dummy_resource_form.rb +3 -0
- data/config/locales/ar.yml +1 -0
- data/config/locales/bg-BG.yml +56 -0
- data/config/locales/ca.yml +15 -0
- data/config/locales/cs.yml +16 -1
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/de.yml +16 -0
- data/config/locales/el-GR.yml +1 -0
- data/config/locales/el.yml +56 -0
- data/config/locales/en.yml +15 -0
- data/config/locales/es-MX.yml +15 -0
- data/config/locales/es-PY.yml +15 -0
- data/config/locales/es.yml +15 -0
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/fi-plain.yml +15 -0
- data/config/locales/fi.yml +15 -0
- data/config/locales/fr-CA.yml +56 -0
- data/config/locales/fr.yml +15 -0
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hu.yml +11 -2
- data/config/locales/is-IS.yml +21 -0
- data/config/locales/it.yml +18 -2
- data/config/locales/ja-JP.yml +56 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lv-LV.yml +54 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/nl.yml +15 -0
- data/config/locales/no.yml +36 -0
- data/config/locales/pl.yml +26 -10
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/pt.yml +26 -10
- data/config/locales/ro-RO.yml +56 -0
- data/config/locales/ru.yml +13 -0
- data/config/locales/sk-SK.yml +47 -0
- data/config/locales/sk.yml +47 -0
- data/config/locales/sl.yml +5 -0
- data/config/locales/sr-CS.yml +8 -0
- data/config/locales/sv.yml +16 -0
- data/lib/decidim/dev/assets/city.jpeg +0 -0
- data/lib/decidim/dev/assets/city2.jpeg +0 -0
- data/lib/decidim/dev/assets/city3.jpeg +0 -0
- data/lib/decidim/dev/assets/participatory_processes.json +434 -0
- data/lib/decidim/dev/assets/participatory_processes_with_null.json +103 -0
- data/lib/decidim/dev/test/base_spec_helper.rb +14 -0
- data/lib/decidim/dev/test/rspec_support/authorization.rb +3 -0
- data/lib/decidim/dev/test/rspec_support/capybara.rb +1 -1
- data/lib/decidim/dev/test/rspec_support/capybara_data_picker.rb +15 -5
- data/lib/decidim/dev/test/rspec_support/capybara_scopes_picker.rb +5 -5
- data/lib/decidim/dev/test/rspec_support/comments.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/component.rb +71 -2
- data/lib/decidim/dev/test/rspec_support/confirmation_helpers.rb +60 -0
- data/lib/decidim/dev/test/rspec_support/content_processing.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/geocoder.rb +1 -2
- data/lib/decidim/dev/test/rspec_support/helpers.rb +2 -2
- data/lib/decidim/dev/test/rspec_support/timezone.rb +7 -0
- data/lib/decidim/dev/version.rb +1 -1
- metadata +66 -16
- data/lib/decidim/dev/test/rspec_support/capybara_proposals_picker.rb +0 -51
@@ -0,0 +1,103 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"id": 1,
|
4
|
+
"title": {
|
5
|
+
"ca": "Laborum totam et nisi autem.",
|
6
|
+
"en": "Tempora esse debitis in ut.",
|
7
|
+
"es": "Eum quia ut maiores officia."
|
8
|
+
},
|
9
|
+
"subtitle": {
|
10
|
+
"ca": "Sit ut.",
|
11
|
+
"en": "Consequatur sed.",
|
12
|
+
"es": "In laudantium."
|
13
|
+
},
|
14
|
+
"slug": "distinctio-cupiditate",
|
15
|
+
"hashtag": "harum",
|
16
|
+
"short_description": {
|
17
|
+
"ca": "<p>Harum magnam id.</p>",
|
18
|
+
"en": "<p>Aut quam doloribus.</p>",
|
19
|
+
"es": "<p>Vel eaque voluptatem.</p>"
|
20
|
+
},
|
21
|
+
"description": {
|
22
|
+
"ca": "<p>Eius velit earum. Dolorem consequuntur ullam. Atque autem non.</p>",
|
23
|
+
"en": "<p>Ad quaerat consequuntur. Voluptas dignissimos eos. Eos saepe et.</p>",
|
24
|
+
"es": "<p>Omnis similique illo. Expedita adipisci qui. Voluptas cupiditate qui.</p>"
|
25
|
+
},
|
26
|
+
"announcement": null,
|
27
|
+
"start_date": "2019-10-02",
|
28
|
+
"end_date": "2019-12-02",
|
29
|
+
"remote_hero_image_url": "http://localhost:3000/uploads/decidim/participatory_process/hero_image/1/city.jpeg",
|
30
|
+
"remote_banner_image_url": "http://localhost:3000/uploads/decidim/participatory_process/banner_image/1/city2.jpeg",
|
31
|
+
"developer_group": {
|
32
|
+
"ca": "Reiciendis.",
|
33
|
+
"en": "Nostrum.",
|
34
|
+
"es": "Aut."
|
35
|
+
},
|
36
|
+
"local_area": {
|
37
|
+
"ca": "Eum necessitatibus.",
|
38
|
+
"en": "Aspernatur perspiciatis.",
|
39
|
+
"es": "A laudantium."
|
40
|
+
},
|
41
|
+
"meta_scope": {
|
42
|
+
"ca": "sint",
|
43
|
+
"en": "voluptas",
|
44
|
+
"es": "ullam"
|
45
|
+
},
|
46
|
+
"participatory_scope": {
|
47
|
+
"ca": "Ad.",
|
48
|
+
"en": "Amet.",
|
49
|
+
"es": "Excepturi."
|
50
|
+
},
|
51
|
+
"participatory_structure": {
|
52
|
+
"ca": "Eos est.",
|
53
|
+
"en": "Quaerat mollitia.",
|
54
|
+
"es": "Vel iusto."
|
55
|
+
},
|
56
|
+
"target": {
|
57
|
+
"ca": "Ratione amet harum.",
|
58
|
+
"en": "Deserunt nulla modi.",
|
59
|
+
"es": "Aut quae ipsa."
|
60
|
+
},
|
61
|
+
"area": {
|
62
|
+
"id": null,
|
63
|
+
"name": {
|
64
|
+
"en": "",
|
65
|
+
"ca": "",
|
66
|
+
"es": ""
|
67
|
+
}
|
68
|
+
},
|
69
|
+
"participatory_process_group": {
|
70
|
+
"id": 1,
|
71
|
+
"name": {
|
72
|
+
"ca": "Molestias pariatur eaque.",
|
73
|
+
"en": "Iure iusto ut.",
|
74
|
+
"es": "Pariatur culpa reprehenderit."
|
75
|
+
},
|
76
|
+
"description": {
|
77
|
+
"ca": "<p>Et accusamus debitis. Sint voluptatem velit. Quia architecto at.</p>",
|
78
|
+
"en": "<p>Sunt eius labore. Odit fugiat numquam. Et consequatur pariatur.</p>",
|
79
|
+
"es": "<p>Rerum aperiam omnis. Optio est quo. Odit est eveniet.</p>"
|
80
|
+
},
|
81
|
+
"remote_hero_image_url": "http://localhost:3000/uploads/decidim/participatory_process_group/hero_image/1/city.jpeg"
|
82
|
+
},
|
83
|
+
"scope": {
|
84
|
+
"id": 1,
|
85
|
+
"name": {
|
86
|
+
"ca": "South Carolina",
|
87
|
+
"en": "South Carolina",
|
88
|
+
"es": "South Carolina"
|
89
|
+
}
|
90
|
+
},
|
91
|
+
"private_space": false,
|
92
|
+
"promoted": true,
|
93
|
+
"scopes_enabled": true,
|
94
|
+
"show_statistics": true,
|
95
|
+
"participatory_process_steps": null,
|
96
|
+
"participatory_process_categories": null,
|
97
|
+
"attachments": {
|
98
|
+
"attachment_collections": null,
|
99
|
+
"files": null
|
100
|
+
},
|
101
|
+
"components": null
|
102
|
+
}
|
103
|
+
]
|
@@ -22,3 +22,17 @@ Dir["#{engine_spec_dir}/shared/**/*.rb"].each { |f| require f }
|
|
22
22
|
require "paper_trail/frameworks/rspec"
|
23
23
|
|
24
24
|
require_relative "spec_helper"
|
25
|
+
|
26
|
+
if ENV["CI"]
|
27
|
+
require "rspec/retry"
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
# show retry status in spec process
|
31
|
+
config.verbose_retry = true
|
32
|
+
# show exception that triggers a retry if verbose_retry is set to true
|
33
|
+
config.display_try_failure_messages = true
|
34
|
+
|
35
|
+
# Retry failed test, set to 1 for normal behavior
|
36
|
+
config.default_retry_count = ENV.fetch("FAILED_TEST_RETRY_COUNT") { 3 }
|
37
|
+
end
|
38
|
+
end
|
@@ -14,6 +14,7 @@ module Decidim
|
|
14
14
|
routes do
|
15
15
|
root to: proc { [200, {}, ["DUMMY VERIFICATION ENGINE"]] }
|
16
16
|
get :edit_authorization, to: proc { [200, {}, ["CONTINUE YOUR VERIFICATION"]] }
|
17
|
+
get :renew_authorization, to: proc { [200, {}, ["RENEW YOUR VERIFICATION"]] }
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
@@ -23,6 +24,8 @@ end
|
|
23
24
|
Decidim::Verifications.register_workflow(:dummy_authorization_workflow) do |workflow|
|
24
25
|
workflow.engine = Decidim::Verifications::DummyVerification::Engine
|
25
26
|
workflow.expires_in = 1.hour
|
27
|
+
workflow.renewable = true
|
28
|
+
workflow.time_between_renewals = 5.minutes
|
26
29
|
end
|
27
30
|
|
28
31
|
RSpec.configure do |config|
|
@@ -6,15 +6,13 @@ module Capybara
|
|
6
6
|
Struct.new(:data_picker, :global_value).new(find_data_picker(id, multiple: multiple), global_value)
|
7
7
|
end
|
8
8
|
|
9
|
-
private
|
10
|
-
|
11
9
|
def find_data_picker(id, multiple: nil)
|
12
10
|
if multiple.nil?
|
13
|
-
expect(page).to have_selector("div.data-picker
|
11
|
+
expect(page).to have_selector("div.data-picker[id$='#{id}']")
|
14
12
|
else
|
15
|
-
expect(page).to have_selector("div.data-picker.picker-#{multiple ? "multiple" : "single"}
|
13
|
+
expect(page).to have_selector("div.data-picker.picker-#{multiple ? "multiple" : "single"}[id$='#{id}']")
|
16
14
|
end
|
17
|
-
|
15
|
+
first("div.data-picker[id$='#{id}']")
|
18
16
|
end
|
19
17
|
|
20
18
|
def data_picker_pick_current
|
@@ -22,5 +20,17 @@ module Capybara
|
|
22
20
|
expect(body).to have_selector("#data_picker-modal .picker-footer a[data-picker-choose]")
|
23
21
|
body.find("#data_picker-modal .picker-footer a[data-picker-choose]").click
|
24
22
|
end
|
23
|
+
|
24
|
+
def data_picker_choose_value(value)
|
25
|
+
body = find(:xpath, "//body")
|
26
|
+
expect(body).to have_selector("#data_picker-modal input[data-picker-choose][type=checkbox][value=\"#{value}\"]")
|
27
|
+
body.find("#data_picker-modal input[data-picker-choose][type=checkbox][value=\"#{value}\"]").click
|
28
|
+
end
|
29
|
+
|
30
|
+
def data_picker_close
|
31
|
+
body = find(:xpath, "//body")
|
32
|
+
expect(body).to have_selector("#data_picker-modal .picker-footer a[data-close]")
|
33
|
+
body.find("#data_picker-modal .picker-footer a[data-close]").click
|
34
|
+
end
|
25
35
|
end
|
26
36
|
end
|
@@ -10,7 +10,7 @@ module Capybara
|
|
10
10
|
match do |scope_picker|
|
11
11
|
data_picker = scope_picker.data_picker
|
12
12
|
scope_name = expected ? translated(expected.name) : t("decidim.scopes.global")
|
13
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible:
|
13
|
+
expect(data_picker).to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible: :all)
|
14
14
|
expect(data_picker).to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{scope_name}')]]")
|
15
15
|
end
|
16
16
|
end
|
@@ -19,7 +19,7 @@ module Capybara
|
|
19
19
|
match do |scope_picker|
|
20
20
|
data_picker = scope_picker.data_picker
|
21
21
|
scope_name = expected ? translated(expected.name) : t("decidim.scopes.global")
|
22
|
-
expect(data_picker).not_to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible:
|
22
|
+
expect(data_picker).not_to have_selector(".picker-values div input[value='#{expected&.id || scope_picker.global_value}']", visible: :all)
|
23
23
|
expect(data_picker).not_to have_selector(:xpath, "//div[contains(@class,'picker-values')]/div/a[text()[contains(.,'#{scope_name}')]]")
|
24
24
|
end
|
25
25
|
end
|
@@ -27,7 +27,7 @@ module Capybara
|
|
27
27
|
def scope_pick(scope_picker, scope)
|
28
28
|
data_picker = scope_picker.data_picker
|
29
29
|
# use scope_repick to change single scope picker selected scope
|
30
|
-
expect(data_picker).to have_selector(".picker-values:empty", visible:
|
30
|
+
expect(data_picker).to have_selector(".picker-values:empty", visible: :all) if data_picker.has_css?(".picker-single")
|
31
31
|
|
32
32
|
expect(data_picker).to have_selector(".picker-prompt")
|
33
33
|
data_picker.find(".picker-prompt").click
|
@@ -41,7 +41,7 @@ module Capybara
|
|
41
41
|
def scope_repick(scope_picker, old_scope, new_scope)
|
42
42
|
data_picker = scope_picker.data_picker
|
43
43
|
|
44
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{old_scope&.id || scope_picker.global_value}']", visible:
|
44
|
+
expect(data_picker).to have_selector(".picker-values div input[value='#{old_scope&.id || scope_picker.global_value}']", visible: :all)
|
45
45
|
data_picker.find(:xpath, "//div[contains(@class,'picker-values')]/div/input[@value='#{old_scope&.id || scope_picker.global_value}']/../a").click
|
46
46
|
|
47
47
|
# browse to lowest common parent between old and new scope
|
@@ -57,7 +57,7 @@ module Capybara
|
|
57
57
|
def scope_unpick(scope_picker, scope)
|
58
58
|
data_picker = scope_picker.data_picker
|
59
59
|
|
60
|
-
expect(data_picker).to have_selector(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']", visible:
|
60
|
+
expect(data_picker).to have_selector(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']", visible: :all)
|
61
61
|
data_picker.find(".picker-values div input[value='#{scope&.id || scope_picker.global_value}']").click
|
62
62
|
|
63
63
|
expect(scope_picker).to have_scope_not_picked(scope)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module CommentsHelpers
|
4
|
-
def have_comment_from(user, text)
|
4
|
+
def have_comment_from(user, text, opts = {})
|
5
5
|
within "#comments" do
|
6
|
-
have_content(user.name) && have_content(text)
|
6
|
+
have_content(user.name, opts) && have_content(text, opts)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -64,6 +64,8 @@ module Decidim
|
|
64
64
|
include Amendable
|
65
65
|
include Decidim::NewsletterParticipant
|
66
66
|
include Hashtaggable
|
67
|
+
include ::Decidim::Endorsable
|
68
|
+
include Decidim::HasAttachments
|
67
69
|
|
68
70
|
searchable_fields(
|
69
71
|
scope_id: { scope: :id },
|
@@ -103,6 +105,39 @@ module Decidim
|
|
103
105
|
.pluck(:decidim_author_id).flatten.compact.uniq
|
104
106
|
end
|
105
107
|
end
|
108
|
+
|
109
|
+
class CoauthorableDummyResource < ApplicationRecord
|
110
|
+
include ::Decidim::Coauthorable
|
111
|
+
include HasComponent
|
112
|
+
end
|
113
|
+
|
114
|
+
class OfficialAuthorPresenter
|
115
|
+
def name
|
116
|
+
self.class.name
|
117
|
+
end
|
118
|
+
|
119
|
+
def nickname
|
120
|
+
UserBaseEntity.nicknamize(name)
|
121
|
+
end
|
122
|
+
|
123
|
+
def deleted?
|
124
|
+
false
|
125
|
+
end
|
126
|
+
|
127
|
+
def respond_to_missing?
|
128
|
+
true
|
129
|
+
end
|
130
|
+
|
131
|
+
def method_missing(method, *args)
|
132
|
+
if method.to_s.ends_with?("?")
|
133
|
+
false
|
134
|
+
elsif [:avatar_url, :profile_path, :badge, :followers_count].include?(method)
|
135
|
+
""
|
136
|
+
else
|
137
|
+
super
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
106
141
|
end
|
107
142
|
end
|
108
143
|
|
@@ -131,7 +166,8 @@ Decidim.register_component(:dummy) do |component|
|
|
131
166
|
settings.attribute :comments_enabled, type: :boolean, default: true
|
132
167
|
settings.attribute :resources_permissions_enabled, type: :boolean, default: true
|
133
168
|
settings.attribute :dummy_global_attribute_1, type: :boolean
|
134
|
-
settings.attribute :dummy_global_attribute_2, type: :boolean
|
169
|
+
settings.attribute :dummy_global_attribute_2, type: :boolean, readonly: ->(_context) { false }
|
170
|
+
settings.attribute :readonly_attribute, type: :boolean, default: true, readonly: ->(_context) { true }
|
135
171
|
settings.attribute :enable_pads_creation, type: :boolean, default: false
|
136
172
|
settings.attribute :amendments_enabled, type: :boolean, default: false
|
137
173
|
settings.attribute :dummy_global_translatable_text, type: :text, translated: true, editor: true, required: true
|
@@ -140,12 +176,15 @@ Decidim.register_component(:dummy) do |component|
|
|
140
176
|
component.settings(:step) do |settings|
|
141
177
|
settings.attribute :comments_blocked, type: :boolean, default: false
|
142
178
|
settings.attribute :dummy_step_attribute_1, type: :boolean
|
143
|
-
settings.attribute :dummy_step_attribute_2, type: :boolean
|
179
|
+
settings.attribute :dummy_step_attribute_2, type: :boolean, readonly: ->(_context) { false }
|
144
180
|
settings.attribute :dummy_step_translatable_text, type: :text, translated: true, editor: true, required: true
|
181
|
+
settings.attribute :readonly_step_attribute, type: :boolean, default: true, readonly: ->(_context) { true }
|
145
182
|
settings.attribute :amendment_creation_enabled, type: :boolean, default: true
|
146
183
|
settings.attribute :amendment_reaction_enabled, type: :boolean, default: true
|
147
184
|
settings.attribute :amendment_promotion_enabled, type: :boolean, default: true
|
148
185
|
settings.attribute :amendments_visibility, type: :string, default: "all"
|
186
|
+
settings.attribute :endorsements_enabled, type: :boolean, default: false
|
187
|
+
settings.attribute :endorsements_blocked, type: :boolean, default: false
|
149
188
|
end
|
150
189
|
|
151
190
|
component.register_resource(:dummy_resource) do |resource|
|
@@ -156,6 +195,14 @@ Decidim.register_component(:dummy) do |component|
|
|
156
195
|
resource.searchable = true
|
157
196
|
end
|
158
197
|
|
198
|
+
component.register_resource(:coauthorable_dummy_resource) do |resource|
|
199
|
+
resource.name = :coauthorable_dummy
|
200
|
+
resource.model_class_name = "Decidim::DummyResources::CoauthorableDummyResource"
|
201
|
+
resource.template = "decidim/coauthorabledummy_resource/linked_dummys"
|
202
|
+
resource.actions = %w(foo-coauthorable)
|
203
|
+
resource.searchable = false
|
204
|
+
end
|
205
|
+
|
159
206
|
component.register_stat :dummies_count_high, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |components, _start_at, _end_at|
|
160
207
|
components.count * 10
|
161
208
|
end
|
@@ -186,6 +233,7 @@ RSpec.configure do |config|
|
|
186
233
|
t.float :longitude
|
187
234
|
t.datetime :published_at
|
188
235
|
t.integer :coauthorships_count, null: false, default: 0
|
236
|
+
t.integer :endorsements_count, null: false, default: 0
|
189
237
|
|
190
238
|
t.references :decidim_component, index: false
|
191
239
|
t.integer :decidim_author_id, index: false
|
@@ -198,6 +246,27 @@ RSpec.configure do |config|
|
|
198
246
|
t.timestamps
|
199
247
|
end
|
200
248
|
end
|
249
|
+
|
250
|
+
unless ActiveRecord::Base.connection.data_source_exists?("decidim_dummy_resources_coauthorable_dummy_resources")
|
251
|
+
ActiveRecord::Migration.create_table :decidim_dummy_resources_coauthorable_dummy_resources do |t|
|
252
|
+
t.jsonb :translatable_text
|
253
|
+
t.string :title
|
254
|
+
t.string :body
|
255
|
+
t.text :address
|
256
|
+
t.float :latitude
|
257
|
+
t.float :longitude
|
258
|
+
t.datetime :published_at
|
259
|
+
t.integer :coauthorships_count, null: false, default: 0
|
260
|
+
t.integer :endorsements_count, null: false, default: 0
|
261
|
+
|
262
|
+
t.references :decidim_component, index: false
|
263
|
+
t.references :decidim_category, index: false
|
264
|
+
t.references :decidim_scope, index: false
|
265
|
+
t.string :reference
|
266
|
+
|
267
|
+
t.timestamps
|
268
|
+
end
|
269
|
+
end
|
201
270
|
end
|
202
271
|
end
|
203
272
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Helpers that get automatically included in component specs.
|
4
|
+
module ConfirmationHelpers
|
5
|
+
# Overrides the Capybara default accept_confirm because we have replaced the
|
6
|
+
# system's own confirmation modal with foundation based modal.
|
7
|
+
#
|
8
|
+
# See:
|
9
|
+
# https://github.com/teamcapybara/capybara/blob/44621209496fe4dd352709799a0061a80d97d562/lib/capybara/session.rb#L647
|
10
|
+
def accept_confirm(_text = nil, **_options)
|
11
|
+
yield if block_given?
|
12
|
+
|
13
|
+
# The test can already be "within", so find the body using xpath
|
14
|
+
message = nil
|
15
|
+
body = find(:xpath, "/html/body")
|
16
|
+
within(body.find(".confirm-reveal")) do
|
17
|
+
message = find(".confirm-modal-content").text
|
18
|
+
find("a.button[data-confirm-ok]").click
|
19
|
+
end
|
20
|
+
|
21
|
+
message
|
22
|
+
end
|
23
|
+
|
24
|
+
# Overrides the Capybara default dismiss_confirm because we have replaced the
|
25
|
+
# system's own confirmation modal with foundation based modal.
|
26
|
+
#
|
27
|
+
# See:
|
28
|
+
# https://github.com/teamcapybara/capybara/blob/44621209496fe4dd352709799a0061a80d97d562/lib/capybara/session.rb#L657
|
29
|
+
def dismiss_confirm(_text = nil, **_options)
|
30
|
+
yield if block_given?
|
31
|
+
|
32
|
+
# The test can already be "within", so find the body using xpath
|
33
|
+
message = nil
|
34
|
+
body = find(:xpath, "/html/body")
|
35
|
+
within(body.find(".confirm-reveal")) do
|
36
|
+
message = find(".confirm-modal-content").text
|
37
|
+
find("a.button[data-confirm-cancel]").click
|
38
|
+
end
|
39
|
+
|
40
|
+
message
|
41
|
+
end
|
42
|
+
|
43
|
+
# Used to accept the "onbeforeunload" event's normal browser confirm modal
|
44
|
+
# as this cannot be overridden. Original confirm dismiss implementation in
|
45
|
+
# Capybara.
|
46
|
+
def accept_page_unload(text = nil, **options, &blk)
|
47
|
+
page.send(:accept_modal, :confirm, text, options, &blk)
|
48
|
+
end
|
49
|
+
|
50
|
+
# Used to dismiss the "onbeforeunload" event's normal browser confirm modal
|
51
|
+
# as this cannot be overridden. Original confirm dismiss implementation in
|
52
|
+
# Capybara.
|
53
|
+
def dismiss_page_unload(text = nil, **options, &blk)
|
54
|
+
page.send(:dismiss_modal, :confirm, text, options, &blk)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
RSpec.configure do |config|
|
59
|
+
config.include ConfirmationHelpers, type: :system
|
60
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
class ContentParsers::DummyFooParser < ContentParsers::BaseParser
|
5
5
|
def rewrite
|
6
|
-
content.gsub("foo", "
|
6
|
+
content.gsub("foo", "%lorem%")
|
7
7
|
end
|
8
8
|
|
9
9
|
def metadata
|
@@ -13,7 +13,7 @@ module Decidim
|
|
13
13
|
|
14
14
|
class ContentRenderers::DummyFooRenderer < ContentRenderers::BaseRenderer
|
15
15
|
def render
|
16
|
-
content.gsub("
|
16
|
+
content.gsub("%lorem%", "<em>neque dicta enim quasi</em>")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -18,8 +18,7 @@ RSpec.configure do |config|
|
|
18
18
|
# Set geocoder configuration in test mode
|
19
19
|
Decidim.geocoder = {
|
20
20
|
static_map_url: "https://www.example.org/my_static_map",
|
21
|
-
|
22
|
-
here_app_code: "5678"
|
21
|
+
here_api_key: "1234123412341234"
|
23
22
|
}
|
24
23
|
Geocoder.configure(lookup: :test)
|
25
24
|
end
|