Sha256: e8dc86fbc72639d637144fb90ab2181c152bbec91d2dcf7d6af9bc42b41dc6eb
Contents?: true
Size: 1.01 KB
Versions: 54
Compression:
Stored size: 1.01 KB
Contents
# -*- coding: utf-8 -*- #!/usr/bin/env ruby require 'test/unit' require 'hpricot' class TestBuilder < Test::Unit::TestCase def test_escaping_text doc = Hpricot() { b "<a\"b>" } assert_equal "<b><a"b></b>", doc.to_html assert_equal %{<a"b>}, doc.at("text()").to_s end def test_no_escaping_text doc = Hpricot() { div.test.me! { text "<a\"b>" } } assert_equal %{<div class="test" id="me"><a"b></div>}, doc.to_html assert_equal %{<a"b>}, doc.at("text()").to_s end def test_latin1_entities doc = Hpricot() { b "€•" } assert_equal "<b>€•</b>", doc.to_html assert_equal "€•", doc.at("text()").to_s end def test_escaping_attrs text = "<span style='font-family:\"MS Mincho\"'>Some text</span>" assert_equal "<span style=\"font-family:\\\"MS Mincho\\\"\">Some text</span>", Hpricot(text).to_html end def test_korean_utf8_entities a = '한글' doc = Hpricot() { b a } assert_equal "<b>한글</b>", doc.to_html end end
Version data entries
54 entries across 54 versions & 15 rubygems