mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
d081b791a4
git-svn-id: svn://hamptoncatlin.com/haml/trunk@49 7063305b-7217-0410-af8c-cdc13e5119b9
36 lines
1.6 KiB
Ruby
36 lines
1.6 KiB
Ruby
require 'test/unit'
|
|
require File.dirname(__FILE__) + '/../lib/haml/helpers'
|
|
|
|
class HelperTest < Test::Unit::TestCase
|
|
include Haml::Helpers
|
|
|
|
def test_find_and_flatten
|
|
assert_equal(find_and_flatten("<br/><textarea></textarea><br/>"),
|
|
"<br/><textarea></textarea><br/>")
|
|
|
|
assert_equal(find_and_flatten("<code lang='ruby'>TEST!</code>\t\t<p></p>"),
|
|
"<code lang='ruby'>TEST!</code>\t\t<p></p>")
|
|
|
|
assert_equal(find_and_flatten("<pre>Hello\nWorld!\nYOU ARE \rFLAT?\n\rOMGZ!</pre></br>"),
|
|
"<pre>Hello
World!
YOU ARE FLAT?
OMGZ!</pre></br>")
|
|
|
|
assert_equal(find_and_flatten("<div class='text_area_test_area'>\n <textarea>Two\n lines</textarea>\n</div>\n"),
|
|
"<div class='text_area_test_area'>\n <textarea>Two
 lines</textarea>\n</div>\n")
|
|
|
|
assert_equal(find_and_flatten("<code>Two\nlines</code><pre>a\nb\nc</pre>"),
|
|
"<code>Two
lines</code><pre>a
b
c</pre>")
|
|
|
|
assert_equal(find_and_flatten("<pre>Two\nlines</pre>\n<pre>a\nb\nc</pre>"),
|
|
"<pre>Two
lines</pre>\n<pre>a
b
c</pre>")
|
|
end
|
|
|
|
def test_tabs_should_render_correctly
|
|
assert_equal(" ", tabs(1))
|
|
assert_equal(" ", tabs(5))
|
|
end
|
|
|
|
def test_list_of_should_render_correctly
|
|
assert_equal("<li>1</li>\n<li>2</li>", (list_of([1, 2]) { |i| i.to_s}))
|
|
assert_equal("<li>1</li>", (list_of([[1]]) { |i| i.first}))
|
|
end
|
|
end
|