diff options
author | Jimmy Baker <jimmyebaker@gmail.com> | 2008-06-24 22:21:58 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-06-24 23:11:35 -0700 |
commit | 670e22e3724791f51d639f409930fba5af920081 (patch) | |
tree | c8151b176b010c563da9de37717a36277aea6b13 /actionpack/test/controller/html-scanner/document_test.rb | |
parent | 071fe79279e89e650acce6613f13027527d01650 (diff) | |
download | rails-670e22e3724791f51d639f409930fba5af920081.tar.gz rails-670e22e3724791f51d639f409930fba5af920081.tar.bz2 rails-670e22e3724791f51d639f409930fba5af920081.zip |
Patched HTML::Document#initialize call to Node.parse so that it includes the strict argument. [#330]
Diffstat (limited to 'actionpack/test/controller/html-scanner/document_test.rb')
-rw-r--r-- | actionpack/test/controller/html-scanner/document_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/actionpack/test/controller/html-scanner/document_test.rb b/actionpack/test/controller/html-scanner/document_test.rb index 0519533dbd..1c3facb9e3 100644 --- a/actionpack/test/controller/html-scanner/document_test.rb +++ b/actionpack/test/controller/html-scanner/document_test.rb @@ -120,4 +120,29 @@ HTML assert doc.find(:tag => "div", :attributes => { :id => "map" }, :content => "") assert doc.find(:tag => "div", :attributes => { :id => "map" }, :content => nil) end + + def test_parse_invalid_document + assert_nothing_raised do + doc = HTML::Document.new("<html> + <table> + <tr> + <td style=\"color: #FFFFFF; height: 17px; onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" style=\"cursor:pointer; height: 17px;\"; nowrap onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" onmouseout=\"this.bgColor='#0066cc'; this.style.color='#FFFFFF'\" onmouseover=\"this.bgColor='#ffffff'; this.style.color='#0033cc'\">About Us</td> + </tr> + </table> + </html>") + end + end + + def test_invalid_document_raises_exception_when_strict + assert_raises RuntimeError do + doc = HTML::Document.new("<html> + <table> + <tr> + <td style=\"color: #FFFFFF; height: 17px; onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" style=\"cursor:pointer; height: 17px;\"; nowrap onclick=\"window.location.href='http://www.rmeinc.com/about_rme.aspx'\" onmouseout=\"this.bgColor='#0066cc'; this.style.color='#FFFFFF'\" onmouseover=\"this.bgColor='#ffffff'; this.style.color='#0033cc'\">About Us</td> + </tr> + </table> + </html>", true) + end + end + end |