inline_forms_installer 8.1.78 → 8.1.79

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: 1570ef1fd5fb458f1bb2528d02e44466337387f0a09528e56fc4a236f27e7b0d
4
- data.tar.gz: d51d7958f540e714246c87fa85e5d7eb8da8f1723b510dc71b49d69d06002e59
3
+ metadata.gz: 96329b3b35142fa6d6c0988c0a552a170d3710ee43e64ad2053d0ff61137fa99
4
+ data.tar.gz: b27490d5be9e59cc1880f1f1ffe8489b70c32c0a4a95add73098a2373c616108
5
5
  SHA512:
6
- metadata.gz: 446e5e7f783fdc8f17247dfc16dad42a16081ab671232d8eb05742cad35d68ed659cb517f3b908157a110ca7f3328b675d5ab16d6f0c392c960d94748aa120ee
7
- data.tar.gz: b1e0bf6f01a7bf4c53bd5575569057182afb804ced9a7909c23ffee3c9c71d32a1e5b4c6dc411c7480dd791342da8a10d41e140ed9c59e89e4ac278246dc4edd
6
+ metadata.gz: b1f148fb6b931c2b0bb611e20b33e23134be63caefcf6c690965601d3d1fb813f8ce0c0052fc7a0428fed37c28dc908bcd39c0891871a3f3549ad5c0efb2193e
7
+ data.tar.gz: 2be3a05e5dff8dbb3d6fea01934acd2a84a5c5b9edd144b4c9d7af9667f7dc53ba052b29d7f4d34b0fde9d046b0d417543a77656aba1d4edf2a11125837f15e2
@@ -444,7 +444,8 @@ create_file user_cfg.model_path, <<-USER_MODEL.strip_heredoc
444
444
  # via `#{user_cfg.class_name}.inline_forms_list`). Avoids `default_scope`
445
445
  # so callers can `unscope`/`reorder` cleanly when needed.
446
446
  scope :inline_forms_list, -> { order(:name, :id) }
447
- inline_forms_search_on :name, :email
447
+ # Suggestions in the search box while typing, from the names (8.1.79).
448
+ inline_forms_search_on :name, :email, suggest: { on: :name }
448
449
 
449
450
  def _presentation
450
451
  "\#{name}"
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module InlineFormsInstaller
4
- VERSION = "8.1.78"
4
+ VERSION = "8.1.79"
5
5
 
6
6
  # Canonical bare Ruby version (the gemspecs accept any Ruby >= 4.0.0; an app
7
7
  # gets the running Ruby when this one is not there, see ruby_for_app).
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../example_app/example_integration_test_case"
4
+
5
+ # The users list's search box suggests names while the user types
6
+ # (`inline_forms_search_on :name, :email, suggest: { on: :name }`): the list
7
+ # itself answers ?suggest=1&term=… with a JSON array, from the users the
8
+ # signed-in user may see, and inline_forms/datalist_suggest.js fills the
9
+ # box's <datalist>.
10
+ class ExampleAppUserSearchSuggestionsTest < ExampleAppIntegrationTestCase
11
+ setup do
12
+ [ "Martina", "Tina Mart", "Tom" ].each_with_index do |name, i|
13
+ User.create!(name: name, email: "suggest#{i}@example.com", locale: example_app_admin_user.locale,
14
+ password: "suggest999", password_confirmation: "suggest999")
15
+ end
16
+ end
17
+
18
+ test "the users list has a search box with a suggestion list" do
19
+ get users_path
20
+
21
+ assert_response :success
22
+ assert_select "input#input_search[list=input_search_suggestions][data-suggest-url=?]", "#{users_path}?suggest=1"
23
+ assert_select "datalist#input_search_suggestions"
24
+ end
25
+
26
+ test "the list answers names that contain the term, in A-Z order" do
27
+ get users_path(suggest: 1, term: "MAR")
28
+
29
+ assert_response :success
30
+ assert_equal "application/json", @response.media_type
31
+ assert_equal [ "Martina", "Tina Mart" ], JSON.parse(@response.body)
32
+ end
33
+
34
+ test "suggestions come from names only, not from e-mail addresses" do
35
+ get users_path(suggest: 1, term: "suggest")
36
+
37
+ assert_equal [], JSON.parse(@response.body)
38
+ end
39
+
40
+ test "signed out there are no suggestions" do
41
+ sign_out example_app_admin_user
42
+
43
+ get users_path(suggest: 1, term: "mar")
44
+
45
+ assert_response :redirect
46
+ end
47
+
48
+ test "the layout's script bundle carries the suggestion script" do
49
+ get users_path
50
+
51
+ script = @response.parsed_body.css("script[src]").map { |tag| tag["src"] }.find { |src| src.include?("inline_forms/inline_forms") }
52
+ assert script, "the layout loads inline_forms/inline_forms.js"
53
+ get script
54
+ assert_response :success
55
+ assert_includes @response.body, "window.datalistSuggestLoaded"
56
+ end
57
+ 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.78
4
+ version: 8.1.79
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -133,6 +133,7 @@ files:
133
133
  - lib/installer_templates/example_app_tests/test/integration/example_app_stylesheet_test.rb
134
134
  - lib/installer_templates/example_app_tests/test/integration/example_app_turbo_layout_test.rb
135
135
  - lib/installer_templates/example_app_tests/test/integration/example_app_user_locale_test.rb
136
+ - lib/installer_templates/example_app_tests/test/integration/example_app_user_search_suggestions_test.rb
136
137
  - lib/installer_templates/example_app_tests/test/integration/example_app_user_theme_test.rb
137
138
  - lib/installer_templates/example_app_tests/test/integration/example_app_validation_hints_test.rb
138
139
  - lib/installer_templates/example_app_tests/test/models/example_app_apartment_name_validation_test.rb