inline_forms_installer 8.1.19 → 8.1.21

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: 17d9be0ab02be059fbd012c30ab69203572d287491c925d1acbc1db978151b8a
4
- data.tar.gz: 608a5beb0125c3fc5f7580a9eb5f6492933062f1cd5ed7e0d387e04d55f87f8e
3
+ metadata.gz: 0da00593938ac34e84b4460a363616ed7dcb411e78886a391680f18f36f67ced
4
+ data.tar.gz: 8608daaccd3e9406f722a2d4bfcb5b0971489e77edfa2f698b05a6b5489b5e17
5
5
  SHA512:
6
- metadata.gz: 8f34df16a70ce88353c41cb8608b4e7ebba5483b3a0431a4728fa18e6a04cf927f2b21a749799697063d26cb383217e24b19d866deeb05fb5961c5e621021147
7
- data.tar.gz: 3a2b45d3f901cd11d0231052b17a442715ac50df9219127c2bfd175b1d65f979cfddaed25742483486eda6645fa661cf7aef7a10fce69c114fcc59c602f72b45
6
+ metadata.gz: 80ba56a1b679fe91baef7cfba8b405e7dd6311aaa7e57b2f835c6efb95a394e61cf082e96346888711c61c9ef35803ca58e074d7bb22383d9ad2e7c45a48cd7d
7
+ data.tar.gz: 2d294b8be77f2f5a5cafe412c9d01cbcf33d72a76efeb531be97bf68c4a957f4b86a7f758feabbf72e172eb1bdadd99850a92de0c7e60bec408be4798ba68de3
@@ -1,6 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module InlineFormsInstaller
3
- VERSION = "8.1.19"
3
+ VERSION = "8.1.21"
4
4
 
5
5
  # Canonical bare Ruby version (must match gemspec `required_ruby_version`).
6
6
  # Written verbatim into generated apps' `.ruby-version` for rbenv/chruby/asdf/
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../example_app/example_integration_test_case"
4
+
5
+ # Regression for the 8.1.20 validation-hint fixes on FormElementShowcase:
6
+ #
7
+ # * count (integer_field, `numericality: { only_integer: true }`)
8
+ # * price (decimal_field, bare `numericality: true`)
9
+ # * amount (money_field, money-rails `monetize :amount_cents`, which
10
+ # registers a MoneyValidator on `:amount`)
11
+ #
12
+ # Before 8.1.20 a bare `numericality: true` emitted ZERO hint messages
13
+ # (validation_hints dead-code bug), so `price` rendered an EMPTY
14
+ # `validation-hints-source` div, and `amount` had no i18n mapping for the
15
+ # money validator key. The show panel must now render a NON-EMPTY
16
+ # `<ul class="validation-hints-list">` for all three.
17
+ class ExampleAppShowcaseValidationHintsTest < ExampleAppIntegrationTestCase
18
+ setup do
19
+ @full = FormElementShowcase.find_or_create_by!(title: "Hints demo") do |s|
20
+ s.count = 7
21
+ s.price = "12.34"
22
+ s.amount = Money.from_amount(99.95, "USD") if s.respond_to?(:amount=) && defined?(Money)
23
+ end
24
+ @row_frame = "form_element_showcase_#{@full.id}"
25
+ @row_headers = { "Turbo-Frame" => @row_frame, "Accept" => "text/html" }
26
+ end
27
+
28
+ test "count label renders a non-empty validation-hints list" do
29
+ body = show_panel_body
30
+ assert_nonempty_hint(body, :count, "must be a number", "must be an integer")
31
+ end
32
+
33
+ test "price label renders a non-empty validation-hints list (bare numericality: true)" do
34
+ body = show_panel_body
35
+ assert_nonempty_hint(body, :price, "must be a number")
36
+ end
37
+
38
+ test "amount label renders a non-empty validation-hints list (money-rails validator)" do
39
+ skip "money-rails monetize not configured" unless FormElementShowcase.respond_to?(:monetized_attributes) &&
40
+ FormElementShowcase.monetized_attributes.key?("amount")
41
+
42
+ body = show_panel_body
43
+ assert_nonempty_hint(body, :amount, "must be a valid amount")
44
+ end
45
+
46
+ private
47
+
48
+ def show_panel_body
49
+ get form_element_showcase_path(@full, update: @row_frame), headers: @row_headers
50
+ assert_response :success
51
+ @response.body
52
+ end
53
+
54
+ # Asserts the hidden `validation-hints-source` div for +attribute+ exists
55
+ # AND contains a populated `<ul class="validation-hints-list">` with each
56
+ # expected message fragment — i.e. not the empty source div the pre-8.1.20
57
+ # bug produced.
58
+ def assert_nonempty_hint(body, attribute, *expected_messages)
59
+ hint_id = "validation_hints_form_element_showcase_#{@full.id}_#{attribute}"
60
+
61
+ assert_includes body, %(data-validation-hints-source="#{hint_id}"),
62
+ "expected has-tip trigger wired to #{hint_id}"
63
+
64
+ source = body[
65
+ %r{<div id="#{Regexp.escape(hint_id)}" class="validation-hints-source" hidden>(.*?)</div>}m,
66
+ 1
67
+ ]
68
+ refute_nil source, "expected a validation-hints-source div for #{attribute}"
69
+ assert_includes source, '<ul class="validation-hints-list">',
70
+ "expected a NON-EMPTY hints list for #{attribute}, got source: #{source.inspect}"
71
+
72
+ expected_messages.each do |message|
73
+ assert_includes source, message,
74
+ "expected #{attribute} hint list to include #{message.inspect}"
75
+ end
76
+ end
77
+ 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.19
4
+ version: 8.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -100,6 +100,7 @@ files:
100
100
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_page_render_test.rb
101
101
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_row_turbo_test.rb
102
102
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_text_fields_test.rb
103
+ - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_validation_hints_test.rb
103
104
  - lib/installer_templates/example_app_tests/test/integration/example_app_turbo_layout_test.rb
104
105
  - lib/installer_templates/example_app_tests/test/integration/example_app_validation_hints_test.rb
105
106
  - lib/installer_templates/example_app_tests/test/models/example_app_apartment_name_validation_test.rb