inline_forms_installer 8.1.13 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca42770916efe32a3a8cb45d1d256f33d9a04ba20c9e94c6c354711f6af59815
4
- data.tar.gz: 744bc785f8ceccad5d77bbb1ee6ecc5b7937a77c1ae957be071c059bdde3e952
3
+ metadata.gz: d5f4f62e8dc739c6bcde28ecb37ec09d51d96fb26083bdf7d6f5b2e0728fe118
4
+ data.tar.gz: 577d7275a99ed7089d373a87da0e271c24c2910054f81350f0777296a99860c4
5
5
  SHA512:
6
- metadata.gz: 956ba42cb0f140f4cc227cba12fee620b4de632eda615b8768e8bec5a0f68ac521a3c965d2c0ab2417c3d9b66c599e54f040197ab418ebcc335927846825cdc2
7
- data.tar.gz: 73e69c8c6ef06f0a37ba777a28117a74312745e1b0dcae05306b6dd60e751cf0050f822e8bbdb8727227032d4838586860691c7005bfaee6fde9fda3e0c1e36e
6
+ metadata.gz: 91383e851c360f5e93ee24175c6b8f9f7bc5eb4ca9163ab167335a1c803ed054c8daa8c723e7576b586e4a03f3250411b6cc4321446ca48d0b034e8ad2d50128
7
+ data.tar.gz: 479e0d53b0c2531a32c943cb7c8e5350ec8b0611c3281b6bd3147b94760e3d2eaa6df6bfc6b3c649a844bf8235f682af136688091fb954b0b4c8bab3fc0663cf
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineFormsInstaller
3
- VERSION = "8.1.13"
3
+ VERSION = "8.1.15"
4
4
 
5
5
  # Written into generated apps' `.ruby-version` (must match gemspec `required_ruby_version`).
6
6
  TARGET_RUBY_VERSION = "ruby-4.0.4"
@@ -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
@@ -61,11 +61,14 @@ class ExampleAppShowcaseRowTurboTest < ExampleAppIntegrationTestCase
61
61
  assert_response :success
62
62
  assert_includes @response.body, "undo"
63
63
 
64
- undo_version_id = @response.body[/revert\/(\d+)/, 1]
65
- assert undo_version_id, "undo link should target a PaperTrail version id"
66
- destroy_version = PaperTrail::Version.find(undo_version_id)
67
- assert_equal "destroy", destroy_version.event,
68
- "undo must target the destroy version, not the last update"
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"
69
72
 
70
73
  post revert_form_element_showcase_path(destroy_version, update: row_frame),
71
74
  headers: {
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.13
4
+ version: 8.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares