From f3fb416b89dab8d7b565b174bdc1116a519ab18d Mon Sep 17 00:00:00 2001 From: "Andrey A.I. Sitnik" Date: Thu, 5 Apr 2012 15:32:37 +0400 Subject: Remove unnecessary in HTML 5 type attribute with default value --- actionpack/test/template/asset_tag_helper_test.rb | 186 ++++++++++----------- actionpack/test/template/erb/tag_helper_test.rb | 6 +- actionpack/test/template/javascript_helper_test.rb | 4 +- actionpack/test/template/url_helper_test.rb | 8 +- 4 files changed, 102 insertions(+), 102 deletions(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 58ff055fc2..2736f6eff0 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -102,20 +102,20 @@ class AssetTagHelperTest < ActionView::TestCase } JavascriptIncludeToTag = { - %(javascript_include_tag("bank")) => %(), - %(javascript_include_tag("bank.js")) => %(), - %(javascript_include_tag("bank", :lang => "vbscript")) => %(), - %(javascript_include_tag("common.javascript", "/elsewhere/cools")) => %(\n), - %(javascript_include_tag(:defaults)) => %(\n\n\n\n\n), - %(javascript_include_tag(:all)) => %(\n\n\n\n\n\n\n), - %(javascript_include_tag(:all, :recursive => true)) => %(\n\n\n\n\n\n\n\n), - %(javascript_include_tag(:defaults, "bank")) => %(\n\n\n\n\n\n), - %(javascript_include_tag(:defaults, "application")) => %(\n\n\n\n\n), - %(javascript_include_tag("bank", :defaults)) => %(\n\n\n\n\n\n), - - %(javascript_include_tag("http://example.com/all")) => %(), - %(javascript_include_tag("http://example.com/all.js")) => %(), - %(javascript_include_tag("//example.com/all.js")) => %(), + %(javascript_include_tag("bank")) => %(), + %(javascript_include_tag("bank.js")) => %(), + %(javascript_include_tag("bank", :lang => "vbscript")) => %(), + %(javascript_include_tag("common.javascript", "/elsewhere/cools")) => %(\n), + %(javascript_include_tag(:defaults)) => %(\n\n\n\n\n), + %(javascript_include_tag(:all)) => %(\n\n\n\n\n\n\n), + %(javascript_include_tag(:all, :recursive => true)) => %(\n\n\n\n\n\n\n\n), + %(javascript_include_tag(:defaults, "bank")) => %(\n\n\n\n\n\n), + %(javascript_include_tag(:defaults, "application")) => %(\n\n\n\n\n), + %(javascript_include_tag("bank", :defaults)) => %(\n\n\n\n\n\n), + + %(javascript_include_tag("http://example.com/all")) => %(), + %(javascript_include_tag("http://example.com/all.js")) => %(), + %(javascript_include_tag("//example.com/all.js")) => %(), } StylePathToTag = { @@ -147,19 +147,19 @@ class AssetTagHelperTest < ActionView::TestCase } StyleLinkToTag = { - %(stylesheet_link_tag("bank")) => %(), - %(stylesheet_link_tag("bank.css")) => %(), - %(stylesheet_link_tag("/elsewhere/file")) => %(), - %(stylesheet_link_tag("subdir/subdir")) => %(), - %(stylesheet_link_tag("bank", :media => "all")) => %(), - %(stylesheet_link_tag(:all)) => %(\n\n), - %(stylesheet_link_tag(:all, :recursive => true)) => %(\n\n\n), - %(stylesheet_link_tag(:all, :media => "all")) => %(\n\n), - %(stylesheet_link_tag("random.styles", "/elsewhere/file")) => %(\n), - - %(stylesheet_link_tag("http://www.example.com/styles/style")) => %(), - %(stylesheet_link_tag("http://www.example.com/styles/style.css")) => %(), - %(stylesheet_link_tag("//www.example.com/styles/style.css")) => %(), + %(stylesheet_link_tag("bank")) => %(), + %(stylesheet_link_tag("bank.css")) => %(), + %(stylesheet_link_tag("/elsewhere/file")) => %(), + %(stylesheet_link_tag("subdir/subdir")) => %(), + %(stylesheet_link_tag("bank", :media => "all")) => %(), + %(stylesheet_link_tag(:all)) => %(\n\n), + %(stylesheet_link_tag(:all, :recursive => true)) => %(\n\n\n), + %(stylesheet_link_tag(:all, :media => "all")) => %(\n\n), + %(stylesheet_link_tag("random.styles", "/elsewhere/file")) => %(\n), + + %(stylesheet_link_tag("http://www.example.com/styles/style")) => %(), + %(stylesheet_link_tag("http://www.example.com/styles/style.css")) => %(), + %(stylesheet_link_tag("//www.example.com/styles/style.css")) => %(), } ImagePathToTag = { @@ -340,7 +340,7 @@ class AssetTagHelperTest < ActionView::TestCase def test_javascript_include_tag_with_given_asset_id ENV["RAILS_ASSET_ID"] = "1" - assert_dom_equal(%(\n\n\n\n\n), javascript_include_tag(:defaults)) + assert_dom_equal(%(\n\n\n\n\n), javascript_include_tag(:defaults)) end def test_javascript_include_tag_is_html_safe @@ -351,35 +351,35 @@ class AssetTagHelperTest < ActionView::TestCase def test_custom_javascript_expansions ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"] - assert_dom_equal %(\n\n\n), javascript_include_tag('controls', :robbery, 'effects') + assert_dom_equal %(\n\n\n), javascript_include_tag('controls', :robbery, 'effects') end def test_custom_javascript_expansions_return_unique_set ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_javascript_expansion :defaults => %w(prototype effects dragdrop controls rails application) - assert_dom_equal %(\n\n\n\n\n), javascript_include_tag(:defaults) + assert_dom_equal %(\n\n\n\n\n), javascript_include_tag(:defaults) end def test_custom_javascript_expansions_and_defaults_puts_application_js_at_the_end ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"] - assert_dom_equal %(\n\n\n\n\n\n\n), javascript_include_tag('controls',:defaults, :robbery, 'effects') + assert_dom_equal %(\n\n\n\n\n\n\n), javascript_include_tag('controls',:defaults, :robbery, 'effects') end def test_javascript_include_tag_should_not_output_the_same_asset_twice ENV["RAILS_ASSET_ID"] = "" - assert_dom_equal %(\n\n\n\n\n), javascript_include_tag('prototype', 'effects', :defaults) + assert_dom_equal %(\n\n\n\n\n), javascript_include_tag('prototype', 'effects', :defaults) end def test_javascript_include_tag_should_not_output_the_same_expansion_twice ENV["RAILS_ASSET_ID"] = "" - assert_dom_equal %(\n\n\n\n\n), javascript_include_tag(:defaults, :defaults) + assert_dom_equal %(\n\n\n\n\n), javascript_include_tag(:defaults, :defaults) end def test_single_javascript_asset_keys_should_take_precedence_over_expansions ENV["RAILS_ASSET_ID"] = "" - assert_dom_equal %(\n\n\n\n\n), javascript_include_tag('controls', :defaults, 'effects') - assert_dom_equal %(\n\n\n\n\n), javascript_include_tag('controls', 'effects', :defaults) + assert_dom_equal %(\n\n\n\n\n), javascript_include_tag('controls', :defaults, 'effects') + assert_dom_equal %(\n\n\n\n\n), javascript_include_tag('controls', 'effects', :defaults) end def test_registering_javascript_expansions_merges_with_existing_expansions @@ -387,7 +387,7 @@ class AssetTagHelperTest < ActionView::TestCase ActionView::Helpers::AssetTagHelper::register_javascript_expansion :can_merge => ['bank'] ActionView::Helpers::AssetTagHelper::register_javascript_expansion :can_merge => ['robber'] ActionView::Helpers::AssetTagHelper::register_javascript_expansion :can_merge => ['bank'] - assert_dom_equal %(\n), javascript_include_tag(:can_merge) + assert_dom_equal %(\n), javascript_include_tag(:can_merge) end def test_custom_javascript_expansions_with_undefined_symbol @@ -396,20 +396,20 @@ class AssetTagHelperTest < ActionView::TestCase def test_custom_javascript_expansions_with_nil_value ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => nil - assert_dom_equal %(\n), javascript_include_tag('first', :monkey, 'last') + assert_dom_equal %(\n), javascript_include_tag('first', :monkey, 'last') end def test_custom_javascript_expansions_with_empty_array_value ActionView::Helpers::AssetTagHelper::register_javascript_expansion :monkey => [] - assert_dom_equal %(\n), javascript_include_tag('first', :monkey, 'last') + assert_dom_equal %(\n), javascript_include_tag('first', :monkey, 'last') end def test_custom_javascript_and_stylesheet_expansion_with_same_name ENV["RAILS_ASSET_ID"] = "" ActionView::Helpers::AssetTagHelper::register_javascript_expansion :robbery => ["bank", "robber"] ActionView::Helpers::AssetTagHelper::register_stylesheet_expansion :robbery => ["money", "security"] - assert_dom_equal %(\n\n\n), javascript_include_tag('controls', :robbery, 'effects') - assert_dom_equal %(\n\n\n), stylesheet_link_tag('style', :robbery, 'print') + assert_dom_equal %(\n\n\n), javascript_include_tag('controls', :robbery, 'effects') + assert_dom_equal %(\n\n\n), stylesheet_link_tag('style', :robbery, 'print') end def test_reset_javascript_expansions @@ -457,36 +457,36 @@ class AssetTagHelperTest < ActionView::TestCase end def test_stylesheet_link_tag_escapes_options - assert_dom_equal %(), stylesheet_link_tag('/file', :media => '), + %(), javascript_include_tag(:all, :cache => true) ) assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => "money") ) assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'money.js')) assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => "/absolute/test") ) @@ -736,7 +736,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal '/javascripts/scripts.js'.length, 23 assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => 'scripts') ) @@ -759,7 +759,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal '/javascripts/vanilla.js'.length, 23 assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => 'vanilla') ) @@ -772,7 +772,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal '/javascripts/secure.js'.length, 22 assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => 'secure') ) @@ -799,7 +799,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal '/javascripts/vanilla.js'.length, 23 assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => 'vanilla') ) @@ -812,7 +812,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal '/javascripts/secure.js'.length, 22 assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => 'secure') ) @@ -830,7 +830,7 @@ class AssetTagHelperTest < ActionView::TestCase number = Zlib.crc32('/javascripts/cache/money.js') % 4 assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => "cache/money") ) @@ -845,7 +845,7 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = true assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => "combined", :recursive => true) ) @@ -866,7 +866,7 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = true assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => "combined") ) @@ -887,14 +887,14 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = true assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => true) ) assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => "money") ) @@ -912,14 +912,14 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = true assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => true) ) assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) assert_dom_equal( - %(), + %(), javascript_include_tag(:all, :cache => "money") ) @@ -936,14 +936,14 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = false assert_dom_equal( - %(), + %(), javascript_include_tag('robber', :cache => true) ) assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) assert_dom_equal( - %(), + %(), javascript_include_tag('robber', :cache => "money", :recursive => true) ) @@ -957,14 +957,14 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = false assert_dom_equal( - %(), + %(), javascript_include_tag('robber', :cache => true) ) assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) assert_dom_equal( - %(), + %(), javascript_include_tag('robber', :cache => "money", :recursive => true) ) @@ -976,24 +976,24 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = false assert_dom_equal( - %(\n\n\n\n\n\n\n), + %(\n\n\n\n\n\n\n), javascript_include_tag(:all, :cache => true) ) assert_dom_equal( - %(\n\n\n\n\n\n\n\n), + %(\n\n\n\n\n\n\n\n), javascript_include_tag(:all, :cache => true, :recursive => true) ) assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::JAVASCRIPTS_DIR, 'all.js')) assert_dom_equal( - %(\n\n\n\n\n\n\n), + %(\n\n\n\n\n\n\n), javascript_include_tag(:all, :cache => "money") ) assert_dom_equal( - %(\n\n\n\n\n\n\n\n), + %(\n\n\n\n\n\n\n\n), javascript_include_tag(:all, :cache => "money", :recursive => true) ) @@ -1051,7 +1051,7 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = true assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => true) ) @@ -1065,14 +1065,14 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal expected_size, File.size(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => "money") ) assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => "/absolute/test") ) @@ -1087,7 +1087,7 @@ class AssetTagHelperTest < ActionView::TestCase ENV["RAILS_ASSET_ID"] = "" assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :concat => true) ) @@ -1095,14 +1095,14 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal expected, File.mtime(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :concat => "money") ) assert File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'money.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :concat => "/absolute/test") ) @@ -1162,7 +1162,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal '/stylesheets/styles.css'.length, 23 assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => 'styles') ) @@ -1178,7 +1178,7 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = true assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => true) ) @@ -1188,7 +1188,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal expected_mtime, File.mtime(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => "money") ) @@ -1205,7 +1205,7 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = true assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => true) ) @@ -1215,7 +1215,7 @@ class AssetTagHelperTest < ActionView::TestCase assert_equal expected_mtime, File.mtime(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag(:all, :cache => "money") ) @@ -1232,14 +1232,14 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = false assert_dom_equal( - %(), + %(), stylesheet_link_tag('robber', :cache => true) ) assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag('robber', :cache => "money") ) @@ -1253,14 +1253,14 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = false assert_dom_equal( - %(), + %(), stylesheet_link_tag('robber', :cache => true) ) assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) assert_dom_equal( - %(), + %(), stylesheet_link_tag('robber', :cache => "money") ) @@ -1275,24 +1275,24 @@ class AssetTagHelperTest < ActionView::TestCase config.perform_caching = false assert_dom_equal( - %(\n\n), + %(\n\n), stylesheet_link_tag(:all, :cache => true) ) assert_dom_equal( - %(\n\n\n), + %(\n\n\n), stylesheet_link_tag(:all, :cache => true, :recursive => true) ) assert !File.exist?(File.join(ActionView::Helpers::AssetTagHelper::STYLESHEETS_DIR, 'all.css')) assert_dom_equal( - %(\n\n), + %(\n\n), stylesheet_link_tag(:all, :cache => "money") ) assert_dom_equal( - %(\n\n\n), + %(\n\n\n), stylesheet_link_tag(:all, :cache => "money", :recursive => true) ) @@ -1369,12 +1369,12 @@ class AssetTagHelperNonVhostTest < ActionView::TestCase def test_should_ignore_asset_host_on_complete_url @controller.config.asset_host = "http://assets.example.com" - assert_dom_equal(%(), stylesheet_link_tag("http://bar.example.com/stylesheets/style.css")) + assert_dom_equal(%(), stylesheet_link_tag("http://bar.example.com/stylesheets/style.css")) end def test_should_ignore_asset_host_on_scheme_relative_url @controller.config.asset_host = "http://assets.example.com" - assert_dom_equal(%(), stylesheet_link_tag("//bar.example.com/stylesheets/style.css")) + assert_dom_equal(%(), stylesheet_link_tag("//bar.example.com/stylesheets/style.css")) end def test_should_wildcard_asset_host_between_zero_and_four diff --git a/actionpack/test/template/erb/tag_helper_test.rb b/actionpack/test/template/erb/tag_helper_test.rb index a384e94766..1724d6432d 100644 --- a/actionpack/test/template/erb/tag_helper_test.rb +++ b/actionpack/test/template/erb/tag_helper_test.rb @@ -11,12 +11,12 @@ module ERBTest end test "percent equals works for javascript_tag" do - expected_output = "" + expected_output = "" assert_equal expected_output, render_content("javascript_tag", "alert('Hello')") end test "percent equals works for javascript_tag with options" do - expected_output = "" + expected_output = "" assert_equal expected_output, render_content("javascript_tag(:id => 'the_js_tag')", "alert('Hello')") end @@ -30,4 +30,4 @@ module ERBTest assert_equal expected_output, render_content("field_set_tag('foo')", "<%= 'hello' %>") end end -end \ No newline at end of file +end diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb index 64898f7ad1..0b96985002 100644 --- a/actionpack/test/template/javascript_helper_test.rb +++ b/actionpack/test/template/javascript_helper_test.rb @@ -75,14 +75,14 @@ class JavaScriptHelperTest < ActionView::TestCase def test_javascript_tag self.output_buffer = 'foo' - assert_dom_equal "", + assert_dom_equal "", javascript_tag("alert('hello')") assert_equal 'foo', output_buffer, 'javascript_tag without a block should not concat to output_buffer' end def test_javascript_tag_with_options - assert_dom_equal "", + assert_dom_equal "", javascript_tag("alert('hello')", :id => "the_js_tag") end diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index b482bd3251..a93a1b816f 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -408,12 +408,12 @@ class UrlHelperTest < ActiveSupport::TestCase def test_mail_to_with_javascript snippet = mail_to("me@domain.com", "My email", :encode => "javascript") - assert_dom_equal "", snippet + assert_dom_equal "", snippet end def test_mail_to_with_javascript_unicode snippet = mail_to("unicode@example.com", "Ășnicode", :encode => "javascript") - assert_dom_equal "", snippet + assert_dom_equal "", snippet end def test_mail_with_options @@ -438,8 +438,8 @@ class UrlHelperTest < ActiveSupport::TestCase assert_dom_equal "me(at)domain.com", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)") assert_dom_equal "My email", mail_to("me@domain.com", "My email", :encode => "hex", :replace_at => "(at)") assert_dom_equal "me(at)domain(dot)com", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)", :replace_dot => "(dot)") - assert_dom_equal "", mail_to("me@domain.com", "My email", :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)") - assert_dom_equal "", mail_to("me@domain.com", nil, :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)") + assert_dom_equal "", mail_to("me@domain.com", "My email", :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)") + assert_dom_equal "", mail_to("me@domain.com", nil, :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)") end def test_mail_to_returns_html_safe_string -- cgit v1.2.3