releaf-content 2.0.0 → 2.0.1
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
- metadata +5 -51
- data/spec/builders/content/nodes/action_dialog_spec.rb +0 -39
- data/spec/builders/content/nodes/content_form_builder_spec.rb +0 -24
- data/spec/builders/content/nodes/form_builder_spec.rb +0 -262
- data/spec/builders/content/nodes/toolbox_builder_spec.rb +0 -77
- data/spec/controllers/releaf/content/nodes_controller_spec.rb +0 -52
- data/spec/features/nodes_services_spec.rb +0 -437
- data/spec/features/nodes_spec.rb +0 -573
- data/spec/fixtures/dummy.png +0 -0
- data/spec/lib/releaf/content/acts_as_node_spec.rb +0 -90
- data/spec/lib/releaf/content/configuration_spec.rb +0 -159
- data/spec/lib/releaf/content/engine_spec.rb +0 -149
- data/spec/lib/releaf/content/node_spec.rb +0 -593
- data/spec/lib/releaf/content/route_spec.rb +0 -229
- data/spec/middleware/routes_reloader_spec.rb +0 -96
- data/spec/routing/node_mapper_spec.rb +0 -311
- data/spec/services/releaf/content/build_route_objects_spec.rb +0 -72
- data/spec/services/releaf/content/node/copy_spec.rb +0 -338
- data/spec/services/releaf/content/node/move_spec.rb +0 -20
- data/spec/services/releaf/content/node/save_under_parent_spec.rb +0 -49
- data/spec/services/releaf/content/node/service_spec.rb +0 -19
- data/spec/validators/content/node/parent_validator_spec.rb +0 -56
- data/spec/validators/content/node/root_validator_spec.rb +0 -69
- data/spec/validators/content/node/singleness_validator_spec.rb +0 -145
data/spec/features/nodes_spec.rb
DELETED
@@ -1,573 +0,0 @@
|
|
1
|
-
require 'rails_helper'
|
2
|
-
describe "Nodes", js: true, with_tree: true, with_root: true do
|
3
|
-
|
4
|
-
before do
|
5
|
-
Rails.cache.clear
|
6
|
-
# preload ActsAsNode classes
|
7
|
-
Rails.application.eager_load!
|
8
|
-
end
|
9
|
-
|
10
|
-
before do
|
11
|
-
@default_app_host = Capybara.app_host
|
12
|
-
end
|
13
|
-
|
14
|
-
after do
|
15
|
-
Capybara.app_host = @default_app_host
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
before with_releaf_node_controller: true do
|
20
|
-
# stub node config and admin menu to use default releaf node controller
|
21
|
-
|
22
|
-
allow( Releaf.application.config).to receive(:content).and_return(Releaf::Content::Configuration.new(
|
23
|
-
resources: { 'Node' => { controller: 'Releaf::Content::NodesController' } }
|
24
|
-
))
|
25
|
-
|
26
|
-
# preserve default config because it will be needed in after block
|
27
|
-
@default_menu_config = Releaf.application.config.menu.dup
|
28
|
-
stubbed_menu_config = @default_menu_config.map do |item|
|
29
|
-
if item.is_a?(Releaf::ControllerDefinition) && item.controller_name == 'admin/nodes'
|
30
|
-
Releaf::ControllerDefinition.new("releaf/content/nodes")
|
31
|
-
else
|
32
|
-
item.dup
|
33
|
-
end
|
34
|
-
end
|
35
|
-
allow( Releaf.application.config ).to receive(:menu).and_return( Releaf::Configuration.normalize_controllers(stubbed_menu_config) )
|
36
|
-
# reset cached values
|
37
|
-
Releaf.application.config.instance_variable_set(:@controllers, nil)
|
38
|
-
Releaf.application.config.instance_variable_set(:@available_controllers, nil)
|
39
|
-
|
40
|
-
Dummy::Application.reload_routes!
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
before with_multiple_node_classes: true do
|
45
|
-
@default_port_inclusion_state = Capybara.always_include_port
|
46
|
-
Capybara.always_include_port = true
|
47
|
-
|
48
|
-
# stub node config and admin menu to use two node classes with separate controllers
|
49
|
-
|
50
|
-
allow( Releaf.application.config).to receive(:content).and_return(Releaf::Content::Configuration.new(
|
51
|
-
resources: {
|
52
|
-
'Node' => {
|
53
|
-
controller: 'Releaf::Content::NodesController',
|
54
|
-
routing: { site: "main_site", constraints: { host: Regexp.new( "^" + Regexp.escape("releaf.127.0.0.1.nip.io") + "$" ) } }
|
55
|
-
},
|
56
|
-
'OtherSite::OtherNode' => {
|
57
|
-
controller: 'Admin::OtherSite::OtherNodesController',
|
58
|
-
routing: { site: "other_site", constraints: { host: Regexp.new( "^" + Regexp.escape("other.releaf.127.0.0.1.nip.io") + "$" ) } }
|
59
|
-
}
|
60
|
-
}
|
61
|
-
))
|
62
|
-
|
63
|
-
# preserve default config because it will be needed in after block
|
64
|
-
@default_menu_config = Releaf.application.config.menu.dup
|
65
|
-
node_controller_item = Releaf::ControllerDefinition.new("releaf/content/nodes")
|
66
|
-
stubbed_menu_config = @default_menu_config.map do |item|
|
67
|
-
if item.is_a?(Releaf::ControllerDefinition) && item.controller_name == 'admin/nodes'
|
68
|
-
node_controller_item
|
69
|
-
else
|
70
|
-
item.dup
|
71
|
-
end
|
72
|
-
end
|
73
|
-
content_index = stubbed_menu_config.index( node_controller_item )
|
74
|
-
stubbed_menu_config.insert( content_index + 1, Releaf::ControllerDefinition.new("admin/other_site/other_nodes"))
|
75
|
-
|
76
|
-
allow( Releaf.application.config ).to receive(:menu).and_return( Releaf::Configuration.normalize_controllers(stubbed_menu_config) )
|
77
|
-
# reset cached values
|
78
|
-
Releaf.application.config.instance_variable_set(:@controllers, nil)
|
79
|
-
Releaf.application.config.instance_variable_set(:@available_controllers, nil)
|
80
|
-
|
81
|
-
Dummy::Application.reload_routes!
|
82
|
-
end
|
83
|
-
|
84
|
-
|
85
|
-
before do
|
86
|
-
@user = auth_as_user
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
before with_root: true do
|
91
|
-
@lv_root = create(:home_page_node, name: "lv", locale: "lv", slug: "lv")
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
|
-
before with_tree: true do
|
96
|
-
@how_to = create(:text_page_node, parent_id: @lv_root.id)
|
97
|
-
@about_us = create(:text_page_node, parent_id: @lv_root.id, name: "about us", slug: "about-us")
|
98
|
-
@history_node = create(:text_page_node, parent_id: @about_us.id, name: "history")
|
99
|
-
|
100
|
-
@en_root = create(:home_page_node, name: "en", locale: "en", slug: "en")
|
101
|
-
end
|
102
|
-
|
103
|
-
|
104
|
-
before with_tree: true do |example|
|
105
|
-
if example.metadata[:with_releaf_node_controller].blank? && example.metadata[:with_multiple_node_classes].blank?
|
106
|
-
visit admin_nodes_path
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
|
111
|
-
before with_other_tree: true do
|
112
|
-
@other_lv_root = create(:other_home_page_node, name: "Other lv", locale: "lv", slug: "lv")
|
113
|
-
@other_about_us = create(:other_text_page_node, parent_id: @other_lv_root.id, name: "Other about us", slug: "about-us")
|
114
|
-
@other_history = create(:other_text_page_node, parent_id: @other_lv_root.id, name: "Other history", slug: "other-history")
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
after with_multiple_node_classes: true do
|
119
|
-
Capybara.always_include_port = @default_port_inclusion_state
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
|
-
after do |example|
|
124
|
-
|
125
|
-
if example.metadata[:with_releaf_node_controller].present? || example.metadata[:with_multiple_node_classes].present?
|
126
|
-
allow( Releaf.application.config ).to receive(:content).and_call_original
|
127
|
-
allow( Releaf.application.config ).to receive(:menu).and_return(@default_menu_config)
|
128
|
-
|
129
|
-
# reset cached values
|
130
|
-
Releaf.application.config.instance_variable_set(:@controllers, nil)
|
131
|
-
Releaf.application.config.instance_variable_set(:@available_controllers, nil)
|
132
|
-
Dummy::Application.reload_routes!
|
133
|
-
end
|
134
|
-
|
135
|
-
end
|
136
|
-
|
137
|
-
after(:all) do
|
138
|
-
Dummy::Application.reload_routes!
|
139
|
-
end
|
140
|
-
|
141
|
-
|
142
|
-
describe "new node" do
|
143
|
-
|
144
|
-
context "when creating node under root" do
|
145
|
-
it "creates new node in content tree" do
|
146
|
-
@en_root.destroy
|
147
|
-
click_link "Create new resource"
|
148
|
-
click_link "Home page"
|
149
|
-
expect(page).to have_css('.button', text: 'Save')
|
150
|
-
expect(page).to have_no_css('.button', text: 'Save and create another')
|
151
|
-
create_resource do
|
152
|
-
fill_in "resource_name", with: "en"
|
153
|
-
select "en", from: "Locale"
|
154
|
-
end
|
155
|
-
|
156
|
-
expect(page).to have_breadcrumbs("Admin/nodes", "en")
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
context "when creating node under another node" do
|
161
|
-
it "creates new node" do
|
162
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .toolbox-cell button').click
|
163
|
-
click_link "Add child"
|
164
|
-
click_link "Contacts controller"
|
165
|
-
expect(page).to have_css('.button', text: 'Save')
|
166
|
-
expect(page).to have_no_css('.button', text: 'Save and create another')
|
167
|
-
create_resource do
|
168
|
-
fill_in "resource_name", with: "Contacts"
|
169
|
-
end
|
170
|
-
|
171
|
-
expect(page).to have_breadcrumbs("Admin/nodes", "lv", "Contacts")
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe "tree collapsing" do
|
177
|
-
context "when not opened before" do
|
178
|
-
it "does not show node's children" do
|
179
|
-
expect(page).to have_css('li[data-id="' + @lv_root.id.to_s + '"].collapsed')
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
context "when clicked to uncollapse node" do
|
184
|
-
it "shows node children" do
|
185
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
186
|
-
|
187
|
-
expect(page).to have_css('li[data-id="' + @lv_root.id.to_s + '"]:not(.collapsed)')
|
188
|
-
end
|
189
|
-
|
190
|
-
it "keeps opened node children visibility permanent" do
|
191
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
192
|
-
wait_for_settings_update("content.tree.expanded.#{@lv_root.id}")
|
193
|
-
visit admin_nodes_path
|
194
|
-
|
195
|
-
expect(page).to have_css('li[data-id="' + @lv_root.id.to_s + '"]:not(.collapsed)')
|
196
|
-
end
|
197
|
-
|
198
|
-
it "keeps closed node children visibility permanent" do
|
199
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
200
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
201
|
-
wait_for_settings_update("content.tree.expanded.#{@lv_root.id}", false)
|
202
|
-
visit admin_nodes_path
|
203
|
-
|
204
|
-
expect(page).to have_css('li[data-id="' + @lv_root.id.to_s + '"].collapsed')
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
describe "copy node to" do
|
210
|
-
context "when copying node" do
|
211
|
-
it "shows copied node in tree" do
|
212
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
213
|
-
find('li[data-id="' + @about_us.id.to_s + '"] > .toolbox-cell button').click
|
214
|
-
click_link("Copy")
|
215
|
-
|
216
|
-
within_dialog do
|
217
|
-
find('label > span', text: "en").click
|
218
|
-
click_button "Copy"
|
219
|
-
end
|
220
|
-
|
221
|
-
expect(page).to have_notification("Copy succeeded")
|
222
|
-
|
223
|
-
find('li[data-id="' + @en_root.id.to_s + '"] > .collapser-cell button').click
|
224
|
-
expect(page).to have_css('li > .node-cell a', text: "about us", count: 2)
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
context "when copying node under itself" do
|
229
|
-
it "displays flash error message" do
|
230
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
231
|
-
find('li[data-id="' + @about_us.id.to_s + '"] > .toolbox-cell button').click
|
232
|
-
click_link("Copy")
|
233
|
-
|
234
|
-
within_dialog do
|
235
|
-
find('label > span', text: "about us").click
|
236
|
-
click_button "Copy"
|
237
|
-
end
|
238
|
-
|
239
|
-
error_text = "source or descendant node can't be parent of new node"
|
240
|
-
expect(page).to have_css('.dialog .form-error-box', text: error_text)
|
241
|
-
end
|
242
|
-
end
|
243
|
-
end
|
244
|
-
|
245
|
-
describe "move node to", js: true do
|
246
|
-
context "when moving node to another parent" do
|
247
|
-
it "moves selected node to new position" do
|
248
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
249
|
-
find('li[data-id="' + @about_us.id.to_s + '"] > .toolbox-cell button').click
|
250
|
-
click_link("Move")
|
251
|
-
|
252
|
-
within_dialog do
|
253
|
-
find('label > span', text: "en").click
|
254
|
-
click_button "Move"
|
255
|
-
end
|
256
|
-
|
257
|
-
expect(page).to have_css('.notifications .notification .message', text: "Move succeeded")
|
258
|
-
expect(page).to have_css('li > .node-cell a', text: "about us", count: 0)
|
259
|
-
find('li[data-id="' + @en_root.id.to_s + '"] > .collapser-cell button').click
|
260
|
-
expect(page).to have_css('li > .node-cell a', text: "about us", count: 1)
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
context "when moving node under itself" do
|
265
|
-
it "displays flash error message" do
|
266
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
267
|
-
find('li[data-id="' + @about_us.id.to_s + '"] > .toolbox-cell button').click
|
268
|
-
click_link("Move")
|
269
|
-
|
270
|
-
within_dialog do
|
271
|
-
find('label > span', text: "about us").click
|
272
|
-
click_button "Move"
|
273
|
-
end
|
274
|
-
|
275
|
-
error_text = "can't be parent to itself"
|
276
|
-
expect(page).to have_css('.dialog .form-error-box', text: error_text)
|
277
|
-
end
|
278
|
-
end
|
279
|
-
|
280
|
-
end
|
281
|
-
|
282
|
-
scenario "Slugs", with_tree: false do
|
283
|
-
visit admin_nodes_path
|
284
|
-
|
285
|
-
open_toolbox_dialog 'Add child', @lv_root, ".view-index .collection li"
|
286
|
-
within_dialog do
|
287
|
-
click_link("Text page")
|
288
|
-
end
|
289
|
-
|
290
|
-
fill_in "Slug", with: "some-slug"
|
291
|
-
fill_in 'Name', with: "About us"
|
292
|
-
expect(page).to have_field("Slug", with: "some-slug")
|
293
|
-
|
294
|
-
fill_in "Slug", with: ""
|
295
|
-
fill_in 'Name', with: "About them"
|
296
|
-
blur_from "Name"
|
297
|
-
expect(page).to have_field("Slug", with: "about-them")
|
298
|
-
|
299
|
-
# fill text to allow text page save
|
300
|
-
fill_in_richtext "Text", with: "asdasd"
|
301
|
-
|
302
|
-
fill_in "Slug", with: "invalid slug <>!"
|
303
|
-
click_button "Save"
|
304
|
-
expect(page).to have_error("is invalid", field: "Slug")
|
305
|
-
click_button "Suggest slug"
|
306
|
-
expect(page).to have_field("Slug", with: "about-them")
|
307
|
-
click_button "Save"
|
308
|
-
expect(page).to have_notification("Create succeeded")
|
309
|
-
end
|
310
|
-
|
311
|
-
describe "node order", with_tree: false do
|
312
|
-
def create_child parent, child_text, position=nil
|
313
|
-
visit admin_nodes_path
|
314
|
-
|
315
|
-
open_toolbox_dialog 'Add child', parent, ".view-index .collection li"
|
316
|
-
within_dialog do
|
317
|
-
click_link("Text page")
|
318
|
-
end
|
319
|
-
|
320
|
-
create_resource do
|
321
|
-
fill_in 'Name', with: child_text
|
322
|
-
fill_in "Slug", with: child_text
|
323
|
-
fill_in_richtext 'Text', with: child_text
|
324
|
-
if position
|
325
|
-
select position, from: 'Item position'
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
|
-
end
|
330
|
-
|
331
|
-
it "creates nodes in correct order" do
|
332
|
-
create_child @lv_root, 'a'
|
333
|
-
create_child @lv_root, 'b', 'After a'
|
334
|
-
create_child @lv_root, 'c', 'After b'
|
335
|
-
create_child @lv_root, 'd', 'After b'
|
336
|
-
create_child @lv_root, 'e', 'First'
|
337
|
-
|
338
|
-
visit admin_nodes_path
|
339
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
340
|
-
|
341
|
-
within(".collection li[data-level='1'][data-id='#{@lv_root.id}'] ul") do
|
342
|
-
expect( page ).to have_content 'e a b d c'
|
343
|
-
end
|
344
|
-
end
|
345
|
-
|
346
|
-
it "by default adds new nodes as last" do
|
347
|
-
create_child @lv_root, 'a'
|
348
|
-
create_child @lv_root, 'b'
|
349
|
-
create_child @lv_root, 'c'
|
350
|
-
|
351
|
-
visit admin_nodes_path
|
352
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
353
|
-
|
354
|
-
within(".collection li[data-level='1'][data-id='#{@lv_root.id}'] ul") do
|
355
|
-
expect( page ).to have_content 'a b c'
|
356
|
-
end
|
357
|
-
end
|
358
|
-
end
|
359
|
-
|
360
|
-
describe "creating node for placeholder model", with_tree: false, with_root: false, js: false do
|
361
|
-
it "create record in association table" do
|
362
|
-
allow_any_instance_of(Releaf::Content::Node::RootValidator).to receive(:validate)
|
363
|
-
visit new_admin_node_path(content_type: 'Bundle')
|
364
|
-
fill_in("resource_name", with: "placeholder model node")
|
365
|
-
expect do
|
366
|
-
click_button 'Save'
|
367
|
-
end.to change { [Node.count, Bundle.count] }.from([0, 0]).to([1, 1])
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
|
-
|
372
|
-
feature "using default releaf content controller", with_releaf_node_controller: true do
|
373
|
-
|
374
|
-
# for this case do not re-test all node features from above
|
375
|
-
# just click around a bit to ensure that the controllers, builders and assets work
|
376
|
-
# and make sure the public page of the created node works
|
377
|
-
|
378
|
-
scenario "basic node operations" do
|
379
|
-
visit "/admin"
|
380
|
-
|
381
|
-
expect(page).to have_no_content 'Admin/nodes'
|
382
|
-
within "aside nav" do
|
383
|
-
click_link "Releaf/content/nodes"
|
384
|
-
end
|
385
|
-
expect(current_path).to eq releaf_content_nodes_path
|
386
|
-
|
387
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .toolbox-cell button').click
|
388
|
-
click_link "Add child"
|
389
|
-
within '.ajaxbox-inner .dialog.content-type' do
|
390
|
-
click_link "Contacts controller"
|
391
|
-
end
|
392
|
-
create_resource do
|
393
|
-
fill_in "resource_name", with: "Contacts"
|
394
|
-
end
|
395
|
-
|
396
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "Contacts")
|
397
|
-
|
398
|
-
visit lv_contacts_page_path
|
399
|
-
expect(page).to have_content "Node class: Node"
|
400
|
-
expect(page).to have_content "Releaf github repository"
|
401
|
-
end
|
402
|
-
end
|
403
|
-
|
404
|
-
feature "breadcrumbs ordering by depth", with_releaf_node_controller: true do
|
405
|
-
# create some nodes and then rearrange them to get some with oldest under newest
|
406
|
-
|
407
|
-
scenario "create and reorder node depth" do
|
408
|
-
visit releaf_content_nodes_path
|
409
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .toolbox-cell button').click
|
410
|
-
click_link "Add child"
|
411
|
-
within '.ajaxbox-inner .dialog.content-type' do
|
412
|
-
click_link "Text page"
|
413
|
-
end
|
414
|
-
create_resource do
|
415
|
-
fill_in "resource_name", with: "TextContent_1"
|
416
|
-
fill_in_richtext 'Text', with: "asdasd"
|
417
|
-
end
|
418
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "TextContent_1")
|
419
|
-
|
420
|
-
visit releaf_content_nodes_path
|
421
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .toolbox-cell button').click
|
422
|
-
click_link "Add child"
|
423
|
-
within '.ajaxbox-inner .dialog.content-type' do
|
424
|
-
click_link "Text page"
|
425
|
-
end
|
426
|
-
create_resource do
|
427
|
-
fill_in "resource_name", with: "TextContent_2"
|
428
|
-
fill_in_richtext 'Text', with: "asdasd"
|
429
|
-
end
|
430
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "TextContent_2")
|
431
|
-
|
432
|
-
visit releaf_content_nodes_path
|
433
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .toolbox-cell button').click
|
434
|
-
click_link "Add child"
|
435
|
-
within '.ajaxbox-inner .dialog.content-type' do
|
436
|
-
click_link "Text page"
|
437
|
-
end
|
438
|
-
create_resource do
|
439
|
-
fill_in "resource_name", with: "TextContent_3"
|
440
|
-
fill_in_richtext 'Text', with: "asdasd"
|
441
|
-
end
|
442
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "TextContent_3")
|
443
|
-
|
444
|
-
|
445
|
-
text_page_1_node_id = Node.find_by(name: "TextContent_1").id
|
446
|
-
text_page_2_node_id = Node.find_by(name: "TextContent_2").id
|
447
|
-
text_page_3_node_id = Node.find_by(name: "TextContent_3").id
|
448
|
-
|
449
|
-
visit edit_releaf_content_node_path(text_page_1_node_id)
|
450
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "TextContent_1")
|
451
|
-
open_toolbox_dialog "Move"
|
452
|
-
within ".dialog" do
|
453
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .collapser-cell button').click
|
454
|
-
find("label[for=new_parent_id_#{text_page_2_node_id}]").click
|
455
|
-
click_button "Move"
|
456
|
-
end
|
457
|
-
expect(page).to have_notification("Move succeeded")
|
458
|
-
|
459
|
-
visit edit_releaf_content_node_path(text_page_2_node_id)
|
460
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "TextContent_2")
|
461
|
-
open_toolbox_dialog "Move"
|
462
|
-
within ".dialog" do
|
463
|
-
find("label[for=new_parent_id_#{text_page_3_node_id}]").click
|
464
|
-
click_button "Move"
|
465
|
-
end
|
466
|
-
expect(page).to have_notification("Move succeeded")
|
467
|
-
|
468
|
-
visit edit_releaf_content_node_path(text_page_1_node_id)
|
469
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "TextContent_3", "TextContent_2", "TextContent_1")
|
470
|
-
end
|
471
|
-
end
|
472
|
-
|
473
|
-
feature "using multiple independent node trees", with_multiple_node_classes: true, with_other_tree: true do
|
474
|
-
|
475
|
-
# here also do not re-test all node features
|
476
|
-
# but ensure that controllers, builders and assets work in both admin node controllers
|
477
|
-
# and that the per-site configuration and hostname restrictions defined in the node config work on public routes
|
478
|
-
|
479
|
-
scenario "multiple site node operations" do
|
480
|
-
|
481
|
-
visit "/admin"
|
482
|
-
|
483
|
-
# make sure that the admin/nodes controller is not available in menu
|
484
|
-
expect(page).to have_no_content 'Admin/nodes'
|
485
|
-
|
486
|
-
# test node creation in releaf/content/nodes controller
|
487
|
-
within "aside nav" do
|
488
|
-
click_link "Releaf/content/nodes"
|
489
|
-
end
|
490
|
-
expect(current_path).to eq releaf_content_nodes_path
|
491
|
-
|
492
|
-
find('li[data-id="' + @lv_root.id.to_s + '"] > .toolbox-cell button').click
|
493
|
-
click_link "Add child"
|
494
|
-
within '.ajaxbox-inner .dialog.content-type' do
|
495
|
-
click_link "Contacts controller"
|
496
|
-
end
|
497
|
-
create_resource do
|
498
|
-
fill_in "resource_name", with: "Main contacts"
|
499
|
-
fill_in "resource_slug", with: "contacts"
|
500
|
-
end
|
501
|
-
expect(page).to have_breadcrumbs("Releaf/content/nodes", "lv", "Main contacts")
|
502
|
-
|
503
|
-
|
504
|
-
# test node creation in the other site nodes controller
|
505
|
-
within "aside nav" do
|
506
|
-
click_link "Admin/other site/other nodes"
|
507
|
-
end
|
508
|
-
expect(current_path).to eq admin_other_site_other_nodes_path
|
509
|
-
find('li[data-id="' + @other_lv_root.id.to_s + '"] > .toolbox-cell button').click
|
510
|
-
click_link "Add child"
|
511
|
-
within '.ajaxbox-inner .dialog.content-type' do
|
512
|
-
click_link "Contacts controller"
|
513
|
-
end
|
514
|
-
create_resource do
|
515
|
-
fill_in "resource_name", with: "Other contacts"
|
516
|
-
fill_in "resource_slug", with: "contacts"
|
517
|
-
end
|
518
|
-
expect(page).to have_breadcrumbs("Admin/other site/other nodes", "lv", "Other contacts")
|
519
|
-
|
520
|
-
|
521
|
-
# test public websites for correct url helpers, node types, site settings and host name constraints
|
522
|
-
|
523
|
-
Capybara.app_host = "http://releaf.127.0.0.1.nip.io"
|
524
|
-
|
525
|
-
visit main_site_lv_home_page_path
|
526
|
-
expect(page).to have_content "Site: main_site"
|
527
|
-
expect(page).to have_content "Node class: Node"
|
528
|
-
expect(page).to have_content "Node name: lv"
|
529
|
-
|
530
|
-
visit "/lv/about-us"
|
531
|
-
expect(URI.parse(current_url).host).to eq "releaf.127.0.0.1.nip.io"
|
532
|
-
expect(page).to have_content "Site: main_site"
|
533
|
-
expect(page).to have_content "Node class: Node"
|
534
|
-
expect(page).to have_content "Node name: about us"
|
535
|
-
|
536
|
-
visit main_site_lv_contacts_page_path
|
537
|
-
expect(page).to have_content "Site: main_site"
|
538
|
-
expect(page).to have_content "Node class: Node"
|
539
|
-
expect(page).to have_content "Node name: Main contacts"
|
540
|
-
|
541
|
-
# make sure the nodes from other site are not reachable via this hostname
|
542
|
-
visit "/lv/other-history"
|
543
|
-
expect( page ).to have_content "The page you were looking for doesn't exist."
|
544
|
-
|
545
|
-
|
546
|
-
Capybara.app_host = "http://other.releaf.127.0.0.1.nip.io"
|
547
|
-
visit other_site_lv_home_page_path
|
548
|
-
expect(page).to have_content "Site: other_site"
|
549
|
-
expect(page).to have_content "Node class: OtherSite::OtherNode"
|
550
|
-
expect(page).to have_content "Node name: Other lv"
|
551
|
-
|
552
|
-
visit "/lv/about-us"
|
553
|
-
expect(URI.parse(current_url).host).to eq "other.releaf.127.0.0.1.nip.io"
|
554
|
-
expect(page).to have_content "Site: other_site"
|
555
|
-
expect(page).to have_content "Node class: OtherSite::OtherNode"
|
556
|
-
expect(page).to have_content "Node name: Other about us"
|
557
|
-
|
558
|
-
visit "/lv/other-history"
|
559
|
-
expect(page).to have_content "Site: other_site"
|
560
|
-
expect(page).to have_content "Node class: OtherSite::OtherNode"
|
561
|
-
expect(page).to have_content "Node name: Other history"
|
562
|
-
|
563
|
-
|
564
|
-
# other site contacts node should not have a route
|
565
|
-
# because the route is constrained to main site in dummy application's routes.rb
|
566
|
-
visit "/lv/contacts"
|
567
|
-
expect( page ).to have_content "The page you were looking for doesn't exist."
|
568
|
-
end
|
569
|
-
|
570
|
-
end
|
571
|
-
|
572
|
-
|
573
|
-
end
|