inline_forms_installer 8.1.65 → 8.1.66

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: dcf1a3e74f85dca6e068bbcdaaa71099f1fc0b2e6507d4192e1305660c78b244
4
- data.tar.gz: 5c20607e05a1ee5db7b1cc69bd979b94068e0d4f62e487391eb4cc151f3ceaea
3
+ metadata.gz: 189ba5e71c9aee58f109af59c1ee01054b3055f88991c1bbc1a9d2e56e710435
4
+ data.tar.gz: e587e52585904ff80d026fced739045a7fc6b1258e3050b65bf5913c740a3508
5
5
  SHA512:
6
- metadata.gz: f8bd143a0eb3fed6bb2427022847f991e1d8f3519dc30e1bf4c07c575fe1b7b72ab5c7c1f327440ac607f033e630b5a6684469170ecb282e67b7cfac5e3718f5
7
- data.tar.gz: 85e195581364c3a4d9a6d360589c3b7fea2cc52f77d271abddd3b36b612e62eaaf210d4a8b0e9d7a977f3937a59c9cdbdb761751d64ac52d27a7a79b6b73b6f6
6
+ metadata.gz: 630596a0231449683d571153e2764c8678868a76646730d977d8efc322c450ec9d2765c5feafb94bd61c46d486ebe5f620720e2e83148c70aba831f13ce821e2
7
+ data.tar.gz: c2329bc07c4804ac8e45ad70a8ac7951d969ef1a8f8dfd48bcf8787bea1d0815212d6c7b7057f7ce8847b7a1721d122d9288230baf1d00fa930b13da5c9e0246
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  module InlineFormsInstaller
4
- VERSION = "8.1.65"
4
+ VERSION = "8.1.66"
5
5
 
6
6
  # Canonical bare Ruby version (must match gemspec `required_ruby_version`).
7
7
  # Written verbatim into generated apps' `.ruby-version` for rbenv/chruby/asdf/
@@ -1,2 +1,3 @@
1
- // Entry for dartsass (see config/initializers/inline_forms_dartsass_builds.rb).
2
- @use "inline_forms/devise" as *;
1
+ // Entry for dartsass (see config/initializers/inline_forms_dartsass_builds.rb,
2
+ // also for why the extension is written out).
3
+ @use "inline_forms/devise.scss" as *;
@@ -13,28 +13,14 @@ Rails.application.config.dartsass.builds = {
13
13
  "inline_forms_install/devise_main.scss" => "inline_forms/devise.css"
14
14
  }
15
15
 
16
- # SELF-IMPORT GUARD: put the inline_forms gem's stylesheet dir FIRST on the
17
- # Sass load path. Dartsass::Runner assembles
18
- # dartsass <build_options> --load-path app/assets/stylesheets
19
- # --load-path <each config.assets.paths entry> <in:out ...>
20
- # and Dart Sass takes the first load path that has a match. app/assets/builds
21
- # is on config.assets.paths BEFORE the gem, and a plain .css file is importable
22
- # by Sass, so `@use "inline_forms/inline_forms"` (and ".../devise") in the
23
- # inline_forms_install/*_main.scss entries would resolve to the PREVIOUS OUTPUT
24
- # app/assets/builds/inline_forms/{inline_forms,devise}.css instead of the gem's
25
- # .scss: from the second build on, each build re-imports its own stale result
26
- # and gem stylesheet changes never reach the app.
27
- #
28
- # The gem dir goes in front of the runner's own --load-path list, as a
29
- # separate argument: not in build_options (the runner splits every entry there
30
- # on whitespace, which breaks a gem path with a space in it) and not first on
31
- # config.assets.paths (Sprockets would then resolve inline_forms/*.css to the
32
- # gem's .scss instead of the compiled build).
33
- require "dartsass/runner"
34
-
35
- module InlineFormsDartsassLoadPath
36
- def dartsass_load_paths
37
- [ "--load-path", InlineForms::Engine.root.join("app/assets/stylesheets").to_s ] + super
38
- end
39
- end
40
- Dartsass::Runner.singleton_class.prepend(InlineFormsDartsassLoadPath)
16
+ # SELF-IMPORT GUARD: the two inline_forms_install/*_main.scss entries `@use`
17
+ # the gem's stylesheets WITH their .scss extension. dartsass-rails passes
18
+ # app/assets/stylesheets and then every config.assets.paths entry as a
19
+ # --load-path, app/assets/builds comes before the gem, and a plain .css file
20
+ # is importable by Sass: a bare `@use "inline_forms/inline_forms"` resolved to
21
+ # the PREVIOUS OUTPUT app/assets/builds/inline_forms/inline_forms.css, so from
22
+ # the second build on each build re-imported its own stale result and gem
23
+ # stylesheet changes never reached the app. With the extension Dart Sass only
24
+ # takes a .scss file (the gem's), and the build fails loudly if the gem ever
25
+ # renames it. (Until 8.1.66 this file prepended the gem dir to
26
+ # Dartsass::Runner.dartsass_load_paths, an internal of dartsass-rails.)
@@ -1,2 +1,3 @@
1
- // Entry for dartsass (see config/initializers/inline_forms_dartsass_builds.rb).
2
- @use "inline_forms/inline_forms" as *;
1
+ // Entry for dartsass (see config/initializers/inline_forms_dartsass_builds.rb,
2
+ // also for why the extension is written out).
3
+ @use "inline_forms/inline_forms.scss" as *;
@@ -1,27 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "test_helper"
4
- require "dartsass/runner"
5
4
  require "sass-embedded"
6
5
 
7
- # config/initializers/inline_forms_dartsass_builds.rb puts the gem's
8
- # stylesheet dir first on the Sass load path. Without it,
9
- # app/assets/builds (ahead of the gem in config.assets.paths) shadows the
10
- # gem's .scss: `@use "inline_forms/inline_forms"` in the
11
- # inline_forms_install/*_main.scss entries re-imports the app's previous
12
- # compiled CSS, and gem stylesheet changes never reach the app after its
13
- # first build. test_helper runs dartsass:build, so by now builds/ already held
14
- # a previous build when this run's one ran.
6
+ # The inline_forms_install/*_main.scss entries `@use` the gem's stylesheets
7
+ # with an explicit .scss extension (config/initializers/
8
+ # inline_forms_dartsass_builds.rb). Without it app/assets/builds (ahead of the
9
+ # gem on the Sass load path) shadows the gem's .scss: a bare
10
+ # `@use "inline_forms/inline_forms"` re-imports the app's previous compiled
11
+ # CSS, and gem stylesheet changes never reach the app after its first build.
12
+ # test_helper runs dartsass:build, so by now builds/ already held a previous
13
+ # build when this run's one ran.
15
14
  class ExampleAppDartsassBuildTest < ActiveSupport::TestCase
16
- test "the gem stylesheet dir is the first Sass load path" do
17
- command = Dartsass::Runner.dartsass_compile_command
18
- first_load_path = command.index { |arg| arg == "--load-path" || arg.start_with?("--load-path=") }
15
+ test "the initializer no longer patches dartsass-rails' load paths" do
16
+ code = Rails.root.join("config/initializers/inline_forms_dartsass_builds.rb").readlines
17
+ .reject { |line| line.lstrip.start_with?("#") }.join
19
18
 
20
- # Two arguments, so a gem path with a space stays one argument.
21
- assert_equal [ "--load-path", gem_stylesheets ], command[first_load_path, 2]
19
+ refute_includes code, "Dartsass::Runner"
22
20
  end
23
21
 
24
22
  %w[inline_forms devise].each do |entry|
23
+ test "inline_forms_install/#{entry}_main.scss uses the gem's #{entry}.scss with its extension" do
24
+ main = Rails.root.join("app/assets/stylesheets/inline_forms_install/#{entry}_main.scss").read
25
+
26
+ assert_includes main, %(@use "inline_forms/#{entry}.scss" as *;)
27
+ end
28
+
25
29
  test "builds/inline_forms/#{entry}.css is compiled from the gem's #{entry}.scss" do
26
30
  built = Rails.root.join("app/assets/builds/inline_forms/#{entry}.css")
27
31
  assert built.file?, "#{built} missing; dartsass:build did not run"
@@ -43,7 +43,7 @@ class ExampleAppLayoutTitleTest < ExampleAppIntegrationTestCase
43
43
  get apartments_path
44
44
 
45
45
  assert_response :success
46
- assert_includes @response.body, %(<html lang="nl">)
46
+ assert_includes @response.body, %(<html lang="nl" class="no-js">)
47
47
  assert_equal expected_title, page_title
48
48
  ensure
49
49
  en = Locale.find_by(name: "en")
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ # The compiled admin and devise stylesheets (test_helper runs dartsass:build).
6
+ # Tippy's CSS was a plain CSS `@import '…/tippy.css'` that the browser
7
+ # resolved to /vendor/assets/stylesheets/tippy.css, a 404 on every page; the
8
+ # gem now inlines it. And the top-bar submenus stay hidden until Foundation
9
+ # initialises them, also after a Turbo Drive visit (html.no-js is gone then).
10
+ class ExampleAppStylesheetTest < ActiveSupport::TestCase
11
+ %w[inline_forms devise].each do |entry|
12
+ test "builds/inline_forms/#{entry}.css inlines tippy and has no CSS @import" do
13
+ css = built(entry)
14
+
15
+ assert_empty css.scan(/@import[^;]*;/), "#{entry}.css: the browser would fetch these"
16
+ assert_includes css, ".tippy-box{position:relative"
17
+ end
18
+ end
19
+
20
+ test "uninitialised top-bar submenus are hidden" do
21
+ assert_includes built("inline_forms"), ".dropdown.menu>li>ul.menu:not(.is-dropdown-submenu){display:none}"
22
+ end
23
+
24
+ private
25
+
26
+ def built(entry)
27
+ path = Rails.root.join("app/assets/builds/inline_forms/#{entry}.css")
28
+ assert path.file?, "#{path} missing; dartsass:build did not run"
29
+ path.read
30
+ end
31
+ end
@@ -11,7 +11,7 @@ class ExampleAppUserLocaleTest < ExampleAppIntegrationTestCase
11
11
  get apartments_path
12
12
 
13
13
  assert_response :success
14
- assert_includes @response.body, %(<html lang="en">)
14
+ assert_includes @response.body, %(<html lang="en" class="no-js">)
15
15
  end
16
16
 
17
17
  test "user locale preference switches I18n for the request" do
@@ -23,7 +23,7 @@ class ExampleAppUserLocaleTest < ExampleAppIntegrationTestCase
23
23
  get apartments_path
24
24
 
25
25
  assert_response :success
26
- assert_includes @response.body, %(<html lang="nl">)
26
+ assert_includes @response.body, %(<html lang="nl" class="no-js">)
27
27
  ensure
28
28
  en = Locale.find_by(name: "en")
29
29
  admin&.update!(locale: en) if en
@@ -38,7 +38,7 @@ class ExampleAppUserLocaleTest < ExampleAppIntegrationTestCase
38
38
  get apartments_path
39
39
 
40
40
  assert_response :success
41
- assert_includes @response.body, %(<html lang="en">)
41
+ assert_includes @response.body, %(<html lang="en" class="no-js">)
42
42
  ensure
43
43
  en = Locale.find_by(name: "en")
44
44
  admin&.update!(locale: en) if en
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.65
4
+ version: 8.1.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ace Suares
@@ -125,6 +125,7 @@ files:
125
125
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_row_turbo_test.rb
126
126
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_text_fields_test.rb
127
127
  - lib/installer_templates/example_app_tests/test/integration/example_app_showcase_validation_hints_test.rb
128
+ - lib/installer_templates/example_app_tests/test/integration/example_app_stylesheet_test.rb
128
129
  - lib/installer_templates/example_app_tests/test/integration/example_app_turbo_layout_test.rb
129
130
  - lib/installer_templates/example_app_tests/test/integration/example_app_user_locale_test.rb
130
131
  - lib/installer_templates/example_app_tests/test/integration/example_app_user_theme_test.rb