Method: TestHtmlToPlainText#test_links

Defined in:
lib/html2email/vendor/premailer/tests/test_html_to_plain_text.rb


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/html2email/vendor/premailer/tests/test_html_to_plain_text.rb', line 48

def test_links
  # basic
  assert_plaintext 'Link ( http://example.com/ )', '<a href="http://example.com/">Link</a>'
  
  # nested html
  assert_plaintext 'Link ( http://example.com/ )', '<a href="http://example.com/"><span class="a">Link</span></a>'
  
  # complex link
  assert_plaintext 'Link ( http://example.com:80/~user?aaa=bb&c=d,e,f#foo )', '<a href="http://example.com:80/~user?aaa=bb&amp;c=d,e,f#foo">Link</a>'
  
  # attributes
  assert_plaintext 'Link ( http://example.com/ )', '<a title=\'title\' href="http://example.com/">Link</a>'
  
  # spacing
  assert_plaintext 'Link ( http://example.com/ )', '<a href="   http://example.com/ "> Link </a>'
  
  # merge links
  assert_plaintext 'Link ( %%LINK%% )', '<a href="%%LINK%%">Link</a>'
  assert_plaintext 'Link ( [LINK] )', '<a href="[LINK]">Link</a>'
  assert_plaintext 'Link ( {LINK} )', '<a href="{LINK}">Link</a>'
end