parent
6df354a5a9
commit
be022e3642
@ -1,2 +1,4 @@
|
||||
haml-3.1.7.gem/haml-4.0.5.gem
|
||||
/haml-4.0.7.gem
|
||||
/haml-5.0.1-tests.tgz
|
||||
/haml-5.0.1.gem
|
||||
|
@ -1,130 +0,0 @@
|
||||
From 1f8821ce8bea3d36b1b7fa01730dff5ec0c0377c Mon Sep 17 00:00:00 2001
|
||||
From: Norman Clarke <norman@njclarke.com>
|
||||
Date: Mon, 8 Jun 2015 14:55:59 -0300
|
||||
Subject: [PATCH] Drop support for Rails 3.
|
||||
|
||||
---
|
||||
lib/haml/helpers/action_view_mods.rb | 8 ++---
|
||||
lib/haml/template/plugin.rb | 2 -
|
||||
test/helper_test.rb | 52 ++++++++++++-----------------------
|
||||
3 files changed, 23 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/lib/haml/helpers/action_view_mods.rb b/lib/haml/helpers/action_view_mods.rb
|
||||
index b17429d..ad0c13c 100644
|
||||
--- a/lib/haml/helpers/action_view_mods.rb
|
||||
+++ b/lib/haml/helpers/action_view_mods.rb
|
||||
@@ -87,11 +87,9 @@ def is_haml?
|
||||
end
|
||||
end
|
||||
|
||||
- if ActionPack::VERSION::MAJOR == 4
|
||||
- module Tags
|
||||
- class TextArea
|
||||
- include HamlSupport
|
||||
- end
|
||||
+ module Tags
|
||||
+ class TextArea
|
||||
+ include HamlSupport
|
||||
end
|
||||
end
|
||||
|
||||
diff --git a/lib/haml/template/plugin.rb b/lib/haml/template/plugin.rb
|
||||
index 322e445..6d96aae 100644
|
||||
--- a/lib/haml/template/plugin.rb
|
||||
+++ b/lib/haml/template/plugin.rb
|
||||
@@ -16,7 +16,7 @@ def handles_encoding?; true; end
|
||||
|
||||
def compile(template)
|
||||
options = Haml::Template.options.dup
|
||||
- if (ActionPack::VERSION::MAJOR >= 4) && template.respond_to?(:type)
|
||||
+ if template.respond_to?(:type)
|
||||
options[:mime_type] = template.type
|
||||
elsif template.respond_to? :mime_type
|
||||
options[:mime_type] = template.mime_type
|
||||
diff --git a/test/helper_test.rb b/test/helper_test.rb
|
||||
index f6293a8..b1f9701 100644
|
||||
--- a/test/helper_test.rb
|
||||
+++ b/test/helper_test.rb
|
||||
@@ -27,6 +27,8 @@
|
||||
end
|
||||
|
||||
class HelperTest < MiniTest::Unit::TestCase
|
||||
+ TEXT_AREA_CONTENT_REGEX = /<(textarea)[^>]*>\n(.*?)<\/\1>/im
|
||||
+
|
||||
Post = Struct.new('Post', :body, :error_field, :errors)
|
||||
class PostErrors
|
||||
def on(name)
|
||||
@@ -157,29 +159,15 @@ def test_pre
|
||||
render('= content_tag "pre", "Foo bar\n baz"', :action_view))
|
||||
end
|
||||
|
||||
- # Rails >= 3.2.3 adds a newline after opening textarea tags.
|
||||
- def self.rails_text_area_helpers_emit_a_newline?
|
||||
- major, minor, tiny = ActionPack::VERSION::MAJOR, ActionPack::VERSION::MINOR, ActionPack::VERSION::TINY
|
||||
- major == 4 || ((major == 3) && (minor >= 2) && (tiny >= 3))
|
||||
- end
|
||||
-
|
||||
- def text_area_content_regex
|
||||
- @text_area_content_regex ||= if self.class.rails_text_area_helpers_emit_a_newline?
|
||||
- /<(textarea)[^>]*>\n(.*?)<\/\1>/im
|
||||
- else
|
||||
- /<(textarea)[^>]*>(.*?)<\/\1>/im
|
||||
- end
|
||||
- end
|
||||
-
|
||||
def test_text_area_tag
|
||||
output = render('= text_area_tag "body", "Foo\nBar\n Baz\n Boom"', :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
assert_equal "Foo
Bar
 Baz
 Boom", match_data[2]
|
||||
end
|
||||
|
||||
def test_text_area
|
||||
output = render('= text_area :post, :body', :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
assert_equal "Foo bar
baz", match_data[2]
|
||||
end
|
||||
|
||||
@@ -187,26 +175,24 @@ def test_partials_should_not_cause_textareas_to_be_indented
|
||||
# non-indentation of textareas rendered inside partials
|
||||
@base.instance_variable_set('@post', Post.new("Foo", nil, PostErrors.new))
|
||||
output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
assert_equal 'Foo', match_data[2]
|
||||
end
|
||||
|
||||
- if rails_text_area_helpers_emit_a_newline?
|
||||
- def test_textareas_should_prerve_leading_whitespace
|
||||
- # leading whitespace preservation
|
||||
- @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
- output = render(".foo\n = text_area :post, :body", :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
- assert_equal '  Foo', match_data[2]
|
||||
- end
|
||||
-
|
||||
- def test_textareas_should_prerve_leading_whitespace_in_partials
|
||||
- # leading whitespace in textareas rendered inside partials
|
||||
- @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
- output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
|
||||
- match_data = output.match(text_area_content_regex)
|
||||
- assert_equal '  Foo', match_data[2]
|
||||
- end
|
||||
+ def test_textareas_should_prerve_leading_whitespace
|
||||
+ # leading whitespace preservation
|
||||
+ @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
+ output = render(".foo\n = text_area :post, :body", :action_view)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
+ assert_equal '  Foo', match_data[2]
|
||||
+ end
|
||||
+
|
||||
+ def test_textareas_should_prerve_leading_whitespace_in_partials
|
||||
+ # leading whitespace in textareas rendered inside partials
|
||||
+ @base.instance_variable_set('@post', Post.new(" Foo", nil, PostErrors.new))
|
||||
+ output = render(".foo\n .bar\n = render '/text_area_helper'", :action_view)
|
||||
+ match_data = output.match(TEXT_AREA_CONTENT_REGEX)
|
||||
+ assert_equal '  Foo', match_data[2]
|
||||
end
|
||||
|
||||
def test_capture_haml
|
@ -1 +1,2 @@
|
||||
54301683936cdf3678f5c513dab3871c haml-4.0.7.gem
|
||||
SHA512 (haml-5.0.1-tests.tgz) = 81782831437545c0f1023bd285a768ef3344c408eb6d492cb4ef9e7a34fa9cffbccf1d9ddacd2502113884e6e43903b4fb22a184f2d69ab458a5661301dbdd79
|
||||
SHA512 (haml-5.0.1.gem) = 9300a810ae7dc30556c177b2eb75f67f0304cbe521ddfa212c6b0f90a193e49c3b78aaefef998fd2a8f9092c945fa54d2613910bc77f4c893febf5e874c81103
|
||||
|
Loading…
Reference in new issue