inline_forms_installer 8.1.11 → 8.1.15
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/lib/inline_forms_installer/version.rb +1 -1
- data/lib/installer_templates/example_app_tests/test/integration/example_app_apartment_row_turbo_test.rb +33 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_photos_test.rb +34 -0
- data/lib/installer_templates/example_app_tests/test/integration/example_app_showcase_row_turbo_test.rb +85 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5f4f62e8dc739c6bcde28ecb37ec09d51d96fb26083bdf7d6f5b2e0728fe118
|
|
4
|
+
data.tar.gz: 577d7275a99ed7089d373a87da0e271c24c2910054f81350f0777296a99860c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91383e851c360f5e93ee24175c6b8f9f7bc5eb4ca9163ab167335a1c803ed054c8daa8c723e7576b586e4a03f3250411b6cc4321446ca48d0b034e8ad2d50128
|
|
7
|
+
data.tar.gz: 479e0d53b0c2531a32c943cb7c8e5350ec8b0611c3281b6bd3147b94760e3d2eaa6df6bfc6b3c649a844bf8235f682af136688091fb954b0b4c8bab3fc0663cf
|
|
@@ -100,4 +100,37 @@ class ExampleAppApartmentRowTurboTest < ExampleAppIntegrationTestCase
|
|
|
100
100
|
assert_includes @response.body, %(target="#{frame}")
|
|
101
101
|
assert_includes @response.body, %(target="#{versions_frame}")
|
|
102
102
|
end
|
|
103
|
+
|
|
104
|
+
test "destroy undo restores rich_text description edited before delete" do
|
|
105
|
+
apt = Apartment.create!(name: "Desc undo apt", title: "T")
|
|
106
|
+
body = "<p>Apartment description survives undo</p>"
|
|
107
|
+
field_frame = "apartment_#{apt.id}_description"
|
|
108
|
+
put apartment_path(
|
|
109
|
+
apt,
|
|
110
|
+
attribute: "description",
|
|
111
|
+
form_element: "rich_text",
|
|
112
|
+
update: field_frame
|
|
113
|
+
), params: { description: body },
|
|
114
|
+
headers: { "Turbo-Frame" => field_frame, "Accept" => "text/html" }
|
|
115
|
+
assert_response :success
|
|
116
|
+
assert_includes apt.reload.description.body.to_html, "survives undo"
|
|
117
|
+
|
|
118
|
+
apt_id = apt.id
|
|
119
|
+
row_frame = "apartment_#{apt_id}"
|
|
120
|
+
delete apartment_path(apt, update: row_frame), headers: @row_headers
|
|
121
|
+
assert_response :success
|
|
122
|
+
|
|
123
|
+
destroy_version = PaperTrail::Version.where(
|
|
124
|
+
item_type: "Apartment",
|
|
125
|
+
item_id: apt_id,
|
|
126
|
+
event: "destroy"
|
|
127
|
+
).order(:id).last
|
|
128
|
+
post revert_apartment_path(destroy_version, update: row_frame),
|
|
129
|
+
headers: {
|
|
130
|
+
"Turbo-Frame" => row_frame,
|
|
131
|
+
"Accept" => "text/vnd.turbo-stream.html"
|
|
132
|
+
}
|
|
133
|
+
assert_response :success
|
|
134
|
+
assert_includes Apartment.find(apt_id).description.body.to_html, "survives undo"
|
|
135
|
+
end
|
|
103
136
|
end
|
|
@@ -19,4 +19,38 @@ class ExampleAppPhotosTest < ExampleAppIntegrationTestCase
|
|
|
19
19
|
Photo.create!(name: "Sunset", apartment: @apartment)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
|
+
|
|
23
|
+
test "nested photo destroy undo restores rich_text description" do
|
|
24
|
+
photo = @apartment.photos.create!(name: "undo.jpg", caption: "c")
|
|
25
|
+
body = "<p>Photo description survives undo</p>"
|
|
26
|
+
field_frame = "apartment_#{@apartment.id}_photo_#{photo.id}_description"
|
|
27
|
+
put photo_path(
|
|
28
|
+
photo,
|
|
29
|
+
attribute: "description",
|
|
30
|
+
form_element: "rich_text",
|
|
31
|
+
update: field_frame
|
|
32
|
+
), params: { description: body },
|
|
33
|
+
headers: { "Turbo-Frame" => field_frame, "Accept" => "text/html" }
|
|
34
|
+
assert_response :success
|
|
35
|
+
assert_includes photo.reload.description.body.to_html, "survives undo"
|
|
36
|
+
|
|
37
|
+
photo_id = photo.id
|
|
38
|
+
row_frame = "apartment_#{@apartment.id}_photo_#{photo_id}"
|
|
39
|
+
delete photo_path(photo, update: row_frame),
|
|
40
|
+
headers: { "Turbo-Frame" => row_frame, "Accept" => "text/html" }
|
|
41
|
+
assert_response :success
|
|
42
|
+
|
|
43
|
+
destroy_version = PaperTrail::Version.where(
|
|
44
|
+
item_type: "Photo",
|
|
45
|
+
item_id: photo_id,
|
|
46
|
+
event: "destroy"
|
|
47
|
+
).order(:id).last
|
|
48
|
+
post revert_photo_path(destroy_version, update: row_frame),
|
|
49
|
+
headers: {
|
|
50
|
+
"Turbo-Frame" => row_frame,
|
|
51
|
+
"Accept" => "text/vnd.turbo-stream.html"
|
|
52
|
+
}
|
|
53
|
+
assert_response :success
|
|
54
|
+
assert_includes Photo.find(photo_id).description.body.to_html, "survives undo"
|
|
55
|
+
end
|
|
22
56
|
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "../example_app/example_integration_test_case"
|
|
4
|
+
|
|
5
|
+
# FormElementShowcase uses the stock InlineFormsController destroy/revert path.
|
|
6
|
+
class ExampleAppShowcaseRowTurboTest < ExampleAppIntegrationTestCase
|
|
7
|
+
setup do
|
|
8
|
+
@showcase = FormElementShowcase.find_or_create_by!(title: "Row turbo demo") { |s| s.count = 1 }
|
|
9
|
+
@row_frame = "form_element_showcase_#{@showcase.id}"
|
|
10
|
+
@row_headers = { "Turbo-Frame" => @row_frame, "Accept" => "text/html" }
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
test "destroy via Turbo DELETE returns undo inside matching turbo-frame" do
|
|
14
|
+
delete form_element_showcase_path(@showcase, update: @row_frame), headers: @row_headers
|
|
15
|
+
assert_response :success
|
|
16
|
+
assert_includes @response.body, %(<turbo-frame id="#{@row_frame}">)
|
|
17
|
+
assert_includes @response.body, "undo"
|
|
18
|
+
assert_not FormElementShowcase.exists?(@showcase.id)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
test "revert via Turbo POST after destroy restores row without CanCan authorization error" do
|
|
22
|
+
showcase_id = @showcase.id
|
|
23
|
+
delete form_element_showcase_path(@showcase, update: @row_frame), headers: @row_headers
|
|
24
|
+
assert_response :success
|
|
25
|
+
|
|
26
|
+
destroy_version = PaperTrail::Version.where(
|
|
27
|
+
item_type: "FormElementShowcase",
|
|
28
|
+
item_id: showcase_id,
|
|
29
|
+
event: "destroy"
|
|
30
|
+
).order(:id).last
|
|
31
|
+
assert destroy_version, "expected a destroy PaperTrail version"
|
|
32
|
+
|
|
33
|
+
post revert_form_element_showcase_path(destroy_version, update: @row_frame),
|
|
34
|
+
headers: {
|
|
35
|
+
"Turbo-Frame" => @row_frame,
|
|
36
|
+
"Accept" => "text/vnd.turbo-stream.html"
|
|
37
|
+
}
|
|
38
|
+
assert_response :success
|
|
39
|
+
assert FormElementShowcase.where(id: showcase_id, title: "Row turbo demo").exists?
|
|
40
|
+
assert_includes @response.body, %(action="replace")
|
|
41
|
+
assert_includes @response.body, %(target="#{@row_frame}")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
test "destroy undo restores plain text area edited on Empty demo" do
|
|
45
|
+
empty = FormElementShowcase.find_or_create_by!(title: "Empty demo")
|
|
46
|
+
body = "Plain text survives undo"
|
|
47
|
+
field_frame = "form_element_showcase_#{empty.id}_body_plain_area"
|
|
48
|
+
put form_element_showcase_path(
|
|
49
|
+
empty,
|
|
50
|
+
attribute: "body_plain_area",
|
|
51
|
+
form_element: "plain_text_area",
|
|
52
|
+
update: field_frame
|
|
53
|
+
), params: { body_plain_area: body },
|
|
54
|
+
headers: { "Turbo-Frame" => field_frame, "Accept" => "text/html" }
|
|
55
|
+
assert_response :success
|
|
56
|
+
assert_equal body, empty.reload.body_plain_area
|
|
57
|
+
|
|
58
|
+
empty_id = empty.id
|
|
59
|
+
row_frame = "form_element_showcase_#{empty_id}"
|
|
60
|
+
delete form_element_showcase_path(empty, update: row_frame), headers: @row_headers
|
|
61
|
+
assert_response :success
|
|
62
|
+
assert_includes @response.body, "undo"
|
|
63
|
+
|
|
64
|
+
destroy_version = PaperTrail::Version.where(
|
|
65
|
+
item_type: "FormElementShowcase",
|
|
66
|
+
item_id: empty_id,
|
|
67
|
+
event: "destroy"
|
|
68
|
+
).order(:id).last
|
|
69
|
+
assert destroy_version, "expected a destroy PaperTrail version"
|
|
70
|
+
assert_match %r{/form_element_showcases/#{destroy_version.id}/revert}, @response.body,
|
|
71
|
+
"undo link should target the destroy version (#{destroy_version.id}), not an update"
|
|
72
|
+
|
|
73
|
+
post revert_form_element_showcase_path(destroy_version, update: row_frame),
|
|
74
|
+
headers: {
|
|
75
|
+
"Turbo-Frame" => row_frame,
|
|
76
|
+
"Accept" => "text/vnd.turbo-stream.html"
|
|
77
|
+
}
|
|
78
|
+
assert_response :success
|
|
79
|
+
assert_equal body, FormElementShowcase.find(empty_id).body_plain_area
|
|
80
|
+
|
|
81
|
+
get form_element_showcase_path(empty_id, update: row_frame),
|
|
82
|
+
headers: @row_headers
|
|
83
|
+
assert_includes @response.body, body
|
|
84
|
+
end
|
|
85
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: inline_forms_installer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.15
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ace Suares
|
|
@@ -117,6 +117,7 @@ files:
|
|
|
117
117
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_locales_associations_test.rb
|
|
118
118
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_numeric_fields_test.rb
|
|
119
119
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_page_render_test.rb
|
|
120
|
+
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_row_turbo_test.rb
|
|
120
121
|
- lib/installer_templates/example_app_tests/test/integration/example_app_showcase_text_fields_test.rb
|
|
121
122
|
- lib/installer_templates/example_app_tests/test/integration/example_app_turbo_layout_test.rb
|
|
122
123
|
- lib/installer_templates/example_app_tests/test/integration/example_app_validation_hints_test.rb
|