aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/test_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-10-18 00:50:52 +0000
committerJamis Buck <jamis@37signals.com>2005-10-18 00:50:52 +0000
commite515ba9ecd43101d31ae9afea8de766e886192dd (patch)
tree6a90ee7a214c86676dd1ad71f4038f233ba00c4f /actionpack/test/controller/test_test.rb
parent9601f96a70445e45428bb14ca069ccbca7a9c113 (diff)
downloadrails-e515ba9ecd43101d31ae9afea8de766e886192dd.tar.gz
rails-e515ba9ecd43101d31ae9afea8de766e886192dd.tar.bz2
rails-e515ba9ecd43101d31ae9afea8de766e886192dd.zip
Fix the html-scanner to count children correctly, playing nicely with :only, fixes #2181 [patrick@lenz.sh]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2670 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/test_test.rb')
-rw-r--r--actionpack/test/controller/test_test.rb21
1 files changed, 19 insertions, 2 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index 20fa9d60b2..04baff6ed6 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -20,6 +20,7 @@ class TestTest < Test::Unit::TestCase
render :text => <<HTML
<html>
<body>
+ <a href="/"><img src="/images/button.png" /></a>
<div id="foo">
<ul>
<li class="item">hello</li>
@@ -121,8 +122,8 @@ HTML
# there is a tag with a child 'input' tag
assert_tag :child => { :tag => "input" }
- # there is no tag with a child 'a' tag
- assert_no_tag :child => { :tag => "a" }
+ # there is no tag with a child 'strong' tag
+ assert_no_tag :child => { :tag => "strong" }
end
def test_assert_tag_ancestor
@@ -233,6 +234,22 @@ HTML
:only => { :tag => "li" } } }
end
+ def test_assert_tag_children_without_content
+ process :test_html_output
+
+ # there is a form tag with an 'input' child which is a self closing tag
+ assert_tag :tag => "form",
+ :children => { :count => 1,
+ :only => { :tag => "input" } }
+
+ # the body tag has an 'a' child which in turn has an 'img' child
+ assert_tag :tag => "body",
+ :children => { :count => 1,
+ :only => { :tag => "a",
+ :children => { :count => 1,
+ :only => { :tag => "img" } } } }
+ end
+
def test_assert_generates
assert_generates 'controller/action/5', :controller => 'controller', :action => 'action', :id => '5'
end