mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Link .js from manifest.js in assets_test
We no longer link JS by default, we need to modify manifest.js for that now.
This commit is contained in:
parent
8d037fd3dd
commit
441917629e
2 changed files with 19 additions and 1 deletions
|
@ -13,6 +13,11 @@ module ApplicationTests
|
|||
|
||||
app_file "app/assets/javascripts/application.js", "//= require_tree ."
|
||||
app_file "app/assets/javascripts/xmlhr.js", "function f1() { alert(); }"
|
||||
app_file "app/assets/config/manifest.js", <<~JS
|
||||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link_directory ../javascripts .js
|
||||
JS
|
||||
app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>"
|
||||
|
||||
app_file "config/routes.rb", <<-RUBY
|
||||
|
|
|
@ -107,7 +107,7 @@ module ApplicationTests
|
|||
end
|
||||
end
|
||||
|
||||
test "precompile application.js and application.css and all other non JS/CSS files" do
|
||||
test "precompile application.js and application.css and all other non JS/CSS files if manifest requests" do
|
||||
app_file "app/assets/javascripts/application.js", "alert();"
|
||||
app_file "app/assets/stylesheets/application.css", "body{}"
|
||||
|
||||
|
@ -120,6 +120,12 @@ module ApplicationTests
|
|||
app_file "app/assets/javascripts/something.else.js.erb", "alert();"
|
||||
app_file "app/assets/stylesheets/something.else.css.erb", "body{}"
|
||||
|
||||
app_file "app/assets/config/manifest.js", <<~JS
|
||||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link_directory ../javascripts .js
|
||||
JS
|
||||
|
||||
images_should_compile = ["a.png", "happyface.png", "happy_face.png", "happy.face.png",
|
||||
"happy-face.png", "happy.happy_face.png", "happy_happy.face.png",
|
||||
"happy.happy.face.png", "-happy.png", "-happy.face.png",
|
||||
|
@ -246,6 +252,7 @@ module ApplicationTests
|
|||
|
||||
test "assets do not require any assets group gem when manifest file is present" do
|
||||
app_file "app/assets/javascripts/application.js", "alert();"
|
||||
app_file "app/assets/config/manifest.js", "//= link application.js"
|
||||
add_to_env_config "production", "config.public_file_server.enabled = true"
|
||||
|
||||
precompile! RAILS_ENV: "production"
|
||||
|
@ -415,6 +422,7 @@ module ApplicationTests
|
|||
app_file "app/models/post.rb", "class Post; end"
|
||||
app_file "app/assets/javascripts/application.js", "//= require_tree ."
|
||||
app_file "app/assets/javascripts/xmlhr.js.erb", "<%= Post.name %>"
|
||||
app_file "app/assets/config/manifest.js", "//= link application.js"
|
||||
|
||||
precompile!
|
||||
|
||||
|
@ -501,6 +509,11 @@ module ApplicationTests
|
|||
app_file "app/assets/javascripts/application.js", "//= require_tree ."
|
||||
app_file "app/assets/javascripts/xmlhr.js", "function f1() { alert(); }"
|
||||
app_file "app/views/posts/index.html.erb", "<%= javascript_include_tag 'application' %>"
|
||||
app_file "app/assets/config/manifest.js", <<~JS
|
||||
//= link_tree ../images
|
||||
//= link_directory ../stylesheets .css
|
||||
//= link_directory ../javascripts .js
|
||||
JS
|
||||
|
||||
app_file "config/routes.rb", <<-RUBY
|
||||
Rails.application.routes.draw do
|
||||
|
|
Loading…
Reference in a new issue