inline_forms_installer 8.1.11 → 8.1.13
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ca42770916efe32a3a8cb45d1d256f33d9a04ba20c9e94c6c354711f6af59815
|
|
4
|
+
data.tar.gz: 744bc785f8ceccad5d77bbb1ee6ecc5b7937a77c1ae957be071c059bdde3e952
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 956ba42cb0f140f4cc227cba12fee620b4de632eda615b8768e8bec5a0f68ac521a3c965d2c0ab2417c3d9b66c599e54f040197ab418ebcc335927846825cdc2
|
|
7
|
+
data.tar.gz: 73e69c8c6ef06f0a37ba777a28117a74312745e1b0dcae05306b6dd60e751cf0050f822e8bbdb8727227032d4838586860691c7005bfaee6fde9fda3e0c1e36e
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
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"
|
|
69
|
+
|
|
70
|
+
post revert_form_element_showcase_path(destroy_version, update: row_frame),
|
|
71
|
+
headers: {
|
|
72
|
+
"Turbo-Frame" => row_frame,
|
|
73
|
+
"Accept" => "text/vnd.turbo-stream.html"
|
|
74
|
+
}
|
|
75
|
+
assert_response :success
|
|
76
|
+
assert_equal body, FormElementShowcase.find(empty_id).body_plain_area
|
|
77
|
+
|
|
78
|
+
get form_element_showcase_path(empty_id, update: row_frame),
|
|
79
|
+
headers: @row_headers
|
|
80
|
+
assert_includes @response.body, body
|
|
81
|
+
end
|
|
82
|
+
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.13
|
|
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
|