Skip to content

Commit 6e62fe9

Browse files
committed
chore: add rails 7.2 spec
1 parent d12d33f commit 6e62fe9

File tree

7 files changed

+42
-0
lines changed

7 files changed

+42
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2+
import "@hotwired/turbo-rails"
3+
import "controllers"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Application } from "@hotwired/stimulus"
2+
3+
const application = Application.start()
4+
5+
// Configure Stimulus development experience
6+
application.debug = false
7+
window.Stimulus = application
8+
9+
export { application }
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Controller } from "@hotwired/stimulus"
2+
3+
export default class extends Controller {
4+
connect() {
5+
this.element.textContent = "Hello World!"
6+
}
7+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Import and register all your controllers from the importmap under controllers/*
2+
3+
import { application } from "controllers/application"
4+
5+
// Eager load all controllers defined in the import map under controllers/**/*_controller
6+
import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7+
eagerLoadControllersFrom("controllers", application)
8+
9+
// Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10+
// import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11+
// lazyLoadControllersFrom("controllers", application)

spec/app/rails_7.2/bin/importmap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env ruby
2+
3+
require_relative "../config/application"
4+
require "importmap/commands"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
eeAQ/OXwC0m/AFe89iINCTXiXfUjEJT0hjQsUdyyR1vH0Z7PxXuMiceL1zms6vjCex9kUIL6PBnaB0QZhWOn9DOEmXF67+1nzvJ5SCTuk33fHouECBHxcRbiIqL2/DtLWq+E49mPdJFL85qZPqfQbNhvVeH7E/kjOFU700KENA1+XDMnmoGRW1ePbDhKSNvsPHRZAX6I4ZirJlYvN9IcN29CTLoYPtcm8J1DAtpTZIlJ+XLgOeJJC606I6WMKcz4wgGl9u7+4q/poP63aUnWgpcagn2MGrVz7GnOdkYIGnapvcr56FesEU8pNjTPrtlCdwU8--hQYbWSSJlVbedEFS--NRIGzBPS6ZyZWUO/8clKpg==
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Pin npm packages by running ./bin/importmap
2+
3+
pin "application"
4+
pin "@hotwired/turbo-rails", to: "turbo.min.js"
5+
pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
6+
pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
7+
pin_all_from "app/javascript/controllers", under: "controllers"

0 commit comments

Comments
 (0)