diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-14 02:13:00 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-08-14 04:12:33 -0300 |
commit | b451de0d6de4df6bc66b274cec73b919f823d5ae (patch) | |
tree | f252c4143a0adb3be7d36d543282539cca0fb971 /actionpack/test/template/html-scanner/tag_node_test.rb | |
parent | 1590377886820e00b1a786616518a32f3b61ec0f (diff) | |
download | rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.gz rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.bz2 rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.zip |
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
Diffstat (limited to 'actionpack/test/template/html-scanner/tag_node_test.rb')
-rw-r--r-- | actionpack/test/template/html-scanner/tag_node_test.rb | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/actionpack/test/template/html-scanner/tag_node_test.rb b/actionpack/test/template/html-scanner/tag_node_test.rb index d1d4667378..9c8fcdc8fc 100644 --- a/actionpack/test/template/html-scanner/tag_node_test.rb +++ b/actionpack/test/template/html-scanner/tag_node_test.rb @@ -7,7 +7,7 @@ class TagNodeTest < Test::Unit::TestCase assert_equal Hash.new, node.attributes assert_nil node.closing end - + def test_open_with_attributes node = tag("<TAG1 foo=hey_ho x:bar=\"blah blah\" BAZ='blah blah blah' >") assert_equal "tag1", node.name @@ -15,28 +15,28 @@ class TagNodeTest < Test::Unit::TestCase assert_equal "blah blah", node["x:bar"] assert_equal "blah blah blah", node["baz"] end - + def test_self_closing_without_attributes node = tag("<tag/>") assert_equal "tag", node.name assert_equal Hash.new, node.attributes assert_equal :self, node.closing end - + def test_self_closing_with_attributes node = tag("<tag a=b/>") assert_equal "tag", node.name assert_equal( { "a" => "b" }, node.attributes ) assert_equal :self, node.closing end - + def test_closing_without_attributes node = tag("</tag>") assert_equal "tag", node.name assert_nil node.attributes assert_equal :close, node.closing end - + def test_bracket_op_when_no_attributes node = tag("</tag>") assert_nil node["foo"] @@ -46,27 +46,27 @@ class TagNodeTest < Test::Unit::TestCase node = tag("<tag a=b/>") assert_equal "b", node["a"] end - + def test_attributes_with_escaped_quotes node = tag("<tag a='b\\'c' b=\"bob \\\"float\\\"\">") assert_equal "b\\'c", node["a"] assert_equal "bob \\\"float\\\"", node["b"] end - + def test_to_s node = tag("<a b=c d='f' g=\"h 'i'\" />") assert_equal %(<a b='c' d='f' g='h \\'i\\'' />), node.to_s end - + def test_tag assert tag("<tag>").tag? end - + def test_match_tag_as_string assert tag("<tag>").match(:tag => "tag") assert !tag("<tag>").match(:tag => "b") end - + def test_match_tag_as_regexp assert tag("<tag>").match(:tag => /t.g/) assert !tag("<tag>").match(:tag => /t[bqs]g/) @@ -77,45 +77,45 @@ class TagNodeTest < Test::Unit::TestCase assert t.match(:attributes => {"a" => "something"}) assert t.match(:attributes => {"b" => "else"}) end - + def test_match_attributes_as_regexp t = tag("<tag a=something b=else />") assert t.match(:attributes => {"a" => /^something$/}) assert t.match(:attributes => {"b" => /e.*e/}) assert t.match(:attributes => {"a" => /me..i/, "b" => /.ls.$/}) end - + def test_match_attributes_as_number t = tag("<tag a=15 b=3.1415 />") assert t.match(:attributes => {"a" => 15}) assert t.match(:attributes => {"b" => 3.1415}) assert t.match(:attributes => {"a" => 15, "b" => 3.1415}) end - + def test_match_attributes_exist t = tag("<tag a=15 b=3.1415 />") assert t.match(:attributes => {"a" => true}) assert t.match(:attributes => {"b" => true}) assert t.match(:attributes => {"a" => true, "b" => true}) end - + def test_match_attributes_not_exist t = tag("<tag a=15 b=3.1415 />") assert t.match(:attributes => {"c" => false}) assert t.match(:attributes => {"c" => nil}) assert t.match(:attributes => {"a" => true, "c" => false}) end - + def test_match_parent_success t = tag("<tag a=15 b='hello'>", tag("<foo k='value'>")) assert t.match(:parent => {:tag => "foo", :attributes => {"k" => /v.l/, "j" => false}}) end - + def test_match_parent_fail t = tag("<tag a=15 b='hello'>", tag("<foo k='value'>")) assert !t.match(:parent => {:tag => /kafka/}) end - + def test_match_child_success t = tag("<tag x:k='something'>") tag("<child v=john a=kelly>", t) @@ -123,7 +123,7 @@ class TagNodeTest < Test::Unit::TestCase assert t.match(:child => { :tag => "sib", :attributes => {"v" => /j/}}) assert t.match(:child => { :attributes => {"a" => "kelly"}}) end - + def test_match_child_fail t = tag("<tag x:k='something'>") tag("<child v=john a=kelly>", t) @@ -131,13 +131,13 @@ class TagNodeTest < Test::Unit::TestCase assert !t.match(:child => { :tag => "sib", :attributes => {"v" => /r/}}) assert !t.match(:child => { :attributes => {"v" => false}}) end - + def test_match_ancestor_success t = tag("<tag x:k='something'>", tag("<parent v=john a=kelly>", tag("<grandparent m=vaughn v=james>"))) assert t.match(:ancestor => {:tag => "parent", :attributes => {"a" => /ll/}}) assert t.match(:ancestor => {:attributes => {"m" => "vaughn"}}) end - + def test_match_ancestor_fail t = tag("<tag x:k='something'>", tag("<parent v=john a=kelly>", tag("<grandparent m=vaughn v=james>"))) assert !t.match(:ancestor => {:tag => /^parent/, :attributes => {"v" => /m/}}) @@ -149,13 +149,13 @@ class TagNodeTest < Test::Unit::TestCase assert t.match(:descendant => {:tag => "child", :attributes => {"a" => /ll/}}) assert t.match(:descendant => {:attributes => {"m" => "vaughn"}}) end - + def test_match_descendant_fail tag("<grandchild m=vaughn v=james>", tag("<child v=john a=kelly>", t = tag("<tag x:k='something'>"))) assert !t.match(:descendant => {:tag => /^child/, :attributes => {"v" => /m/}}) assert !t.match(:descendant => {:attributes => {"v" => false}}) end - + def test_match_child_count t = tag("<tag x:k='something'>") tag("hello", t) @@ -229,7 +229,7 @@ class TagNodeTest < Test::Unit::TestCase end private - + def tag(content, parent=nil) node = HTML::Node.parse(parent,0,0,content) parent.children << node if parent |