File tree Expand file tree Collapse file tree 11 files changed +163
-0
lines changed
Expand file tree Collapse file tree 11 files changed +163
-0
lines changed Original file line number Diff line number Diff line change @@ -22,8 +22,11 @@ gem "propshaft"
2222gem "puma" , "~> 7.0"
2323gem "rack-ssl"
2424gem "sass"
25+ gem "stimulus-rails"
2526gem "stripe"
27+ gem "strong_migrations"
2628gem "thread"
29+ gem "turbo-rails"
2730gem "will_paginate"
2831
2932group :development do
@@ -39,10 +42,12 @@ group :development do
3942end
4043
4144group :development , :test do
45+ gem "bundler-audit" , require : false
4246 gem "capybara"
4347 gem "coveralls_reborn" , require : false
4448 gem "debug"
4549 gem "factory_bot"
50+ gem "factory_bot_rails" , require : false
4651 gem "pry-byebug"
4752 gem "rspec"
4853 gem "rspec-rails"
Original file line number Diff line number Diff line change 100100 brakeman (8.0.2 )
101101 racc
102102 builder (3.3.0 )
103+ bundler-audit (0.9.3 )
104+ bundler (>= 1.2.0 )
105+ thor (~> 1.0 )
103106 byebug (13.0.0 )
104107 reline (>= 0.6.0 )
105108 capybara (3.40.0 )
146149 tzinfo
147150 factory_bot (6.5.6 )
148151 activesupport (>= 6.1.0 )
152+ factory_bot_rails (6.5.1 )
153+ factory_bot (~> 6.5 )
154+ railties (>= 6.1.0 )
149155 feedbag (1.0.2 )
150156 addressable (~> 2.8 )
151157 nokogiri (~> 1.8 , >= 1.8.2 )
381387 simplecov_json_formatter (~> 0.1 )
382388 simplecov-html (0.13.2 )
383389 simplecov_json_formatter (0.1.4 )
390+ stimulus-rails (1.3.4 )
391+ railties (>= 6.0.0 )
384392 stringio (3.2.0 )
385393 stripe (18.3.1 )
394+ strong_migrations (2.5.2 )
395+ activerecord (>= 7.1 )
386396 sync (0.5.0 )
387397 term-ansicolor (1.11.3 )
388398 tins (~> 1 )
396406 readline
397407 sync
398408 tsort (0.2.0 )
409+ turbo-rails (2.0.20 )
410+ actionpack (>= 7.1.0 )
411+ railties (>= 7.1.0 )
399412 tzinfo (2.0.6 )
400413 concurrent-ruby (~> 1.0 )
401414 unicode-display_width (3.2.0 )
@@ -440,11 +453,13 @@ DEPENDENCIES
440453 bcrypt
441454 bootsnap
442455 brakeman
456+ bundler-audit
443457 capybara
444458 coveralls_reborn
445459 debug
446460 dotenv-rails
447461 factory_bot
462+ factory_bot_rails
448463 feedbag
449464 feedjira
450465 good_job (~> 4.13.0 )
@@ -470,8 +485,11 @@ DEPENDENCIES
470485 sass
471486 selenium-webdriver
472487 simplecov
488+ stimulus-rails
473489 stripe
490+ strong_migrations
474491 thread
492+ turbo-rails
475493 web-console
476494 webdrivers
477495 webmock
Original file line number Diff line number Diff line change 11// @ts -nocheck
2+ import "@hotwired/turbo-rails" ;
3+ import "@rails/activestorage" ;
24import "jquery" ;
35import "bootstrap" ;
46import "mousetrap" ;
57import "jquery-visible" ;
68import _ from "underscore" ;
79import Backbone from "backbone" ;
810
11+ import "./controllers/index" ;
12+
13+ Turbo . session . drive = false ;
14+
915/* global jQuery, Mousetrap */
1016var $ = jQuery ;
1117
Original file line number Diff line number Diff line change 1+ import { Application } from "@hotwired/stimulus" ;
2+
3+ const application = Application . start ( ) ;
4+
5+ export { application } ;
Original file line number Diff line number Diff line change 1+ import { Controller } from "@hotwired/stimulus" ;
2+
3+ export default class extends Controller {
4+ connect ( ) : void {
5+ this . element . textContent = "Hello World!" ;
6+ }
7+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * This file is auto-generated by ./bin/rails stimulus:manifest:update
3+ * Run that command whenever you add a new controller or create them with
4+ * ./bin/rails generate stimulus controllerName
5+ */
6+
7+ import { application } from "./application" ;
8+
9+ import DialogController from "./dialog_controller" ;
10+ application . register ( "dialog" , DialogController ) ;
Original file line number Diff line number Diff line change 1212 "dependencies" : {
1313 "@fontsource/lato" : " ^5.2.7" ,
1414 "@fontsource/reenie-beanie" : " ^5.2.8" ,
15+ "@hotwired/stimulus" : " ^3.2.2" ,
16+ "@hotwired/turbo" : " ^8.0.20" ,
17+ "@hotwired/turbo-rails" : " ^8.0.20" ,
18+ "@rails/actioncable" : " ^8.1.100" ,
19+ "@rails/activestorage" : " ^8.1.100" ,
1520 "backbone" : " 1.0.0" ,
1621 "bootstrap" : " 3.1.1" ,
1722 "font-awesome" : " 4.7.0" ,
2530 "@eslint/js" : " ^10.0.1" ,
2631 "@stylistic/eslint-plugin" : " ^5.7.0" ,
2732 "@types/backbone" : " latest" ,
33+ "@types/hotwired__turbo" : " ^8.0.5" ,
2834 "@types/jquery" : " latest" ,
2935 "@types/mousetrap" : " latest" ,
3036 "@types/node" : " ^25.2.3" ,
37+ "@types/rails__actioncable" : " ^8.0.3" ,
3138 "@types/underscore" : " latest" ,
3239 "@typescript-eslint/eslint-plugin" : " ^8.50.0" ,
3340 "@typescript-eslint/parser" : " ^8.50.0" ,
Original file line number Diff line number Diff line change 1+ import { expect , it } from "vitest" ;
2+ import { bootStimulus } from "spec/javascript/support/stimulus" ;
3+ import DialogController from "controllers/dialog_controller" ;
4+
5+ it ( "updates the text content of its element" , async ( ) => {
6+ document . body . innerHTML = "<div data-controller='dialog'></div>" ;
7+ await bootStimulus ( "dialog" , DialogController ) ;
8+
9+ expect ( document . body . textContent ) . toBe ( "Hello World!" ) ;
10+ } ) ;
Original file line number Diff line number Diff line change 1+ import { afterEach } from "vitest" ;
2+ import type { Context , Controller } from "@hotwired/stimulus" ;
3+ import { Application } from "@hotwired/stimulus" ;
4+
5+ let application : Application | null = null ;
6+
7+ type ControllerClass < T > = new ( context : Context ) => T ;
8+
9+ async function bootStimulus < T extends Controller > (
10+ name : string ,
11+ controller : ControllerClass < T > ,
12+ ) : Promise < void > {
13+ application ??= Application . start ( ) ;
14+
15+ application . register ( name , controller ) ;
16+ application . handleError = ( error : Error ) : void => { throw error ; } ;
17+
18+ await Promise . resolve ( ) ;
19+ }
20+
21+ afterEach ( ( ) => {
22+ if ( application ) { application . stop ( ) ; }
23+
24+ application = null ;
25+ } ) ;
26+
27+ export { bootStimulus } ;
You can’t perform that action at this time.
0 commit comments