2013-12-28 23:45:13 +01:00
|
|
|
require 'test_helper'
|
|
|
|
|
2017-06-10 14:28:10 +02:00
|
|
|
# Test some event helper methods
|
2013-12-28 23:45:13 +01:00
|
|
|
class EventsHelperTest < ActionView::TestCase
|
2017-06-10 14:28:10 +02:00
|
|
|
test 'Markdown with empty content' do
|
|
|
|
assert_equal '', to_markdown('')
|
|
|
|
assert_equal '', to_markdown(' ')
|
|
|
|
assert_equal "'", to_markdown("\'")
|
|
|
|
assert_equal '', to_markdown('
|
|
|
|
')
|
|
|
|
end
|
2019-03-03 16:42:33 +01:00
|
|
|
|
|
|
|
test 'HTML elements with a space inside' do
|
|
|
|
assert_equal '**hello world**', to_markdown('<strong>hello world </strong>')
|
|
|
|
assert_equal '**h**,', to_markdown('<strong> h</strong>,')
|
|
|
|
assert_equal '**h**,', to_markdown('<strong>h </strong>,')
|
|
|
|
assert_equal '*ho***h**,', to_markdown('<em>ho</em><strong>h </strong>,')
|
|
|
|
assert_equal '*ho* **h**,', to_markdown('<em>ho</em><strong> h</strong>,')
|
2019-03-03 17:38:45 +01:00
|
|
|
assert_equal '*ho* **h**,', to_markdown('<i>ho</i><b> h</b>,')
|
2019-03-03 16:42:33 +01:00
|
|
|
end
|
2019-03-03 18:17:14 +01:00
|
|
|
|
2019-03-03 19:11:06 +01:00
|
|
|
test 'HTML titles too strong' do
|
2019-06-20 21:59:04 +02:00
|
|
|
assert_equal '**Big**
|
2019-03-03 19:11:06 +01:00
|
|
|
|
|
|
|
', to_markdown('<h1>Big</h1>')
|
2019-06-20 21:59:04 +02:00
|
|
|
|
|
|
|
assert_equal '**Big again**
|
2019-03-03 19:11:06 +01:00
|
|
|
|
|
|
|
', to_markdown('<h2>Big again</h2>')
|
2019-06-20 21:59:04 +02:00
|
|
|
|
|
|
|
assert_equal '**Too**
|
2019-03-03 19:11:06 +01:00
|
|
|
|
|
|
|
', to_markdown('<h3><strong>Too</strong></h3>')
|
2019-03-03 18:17:14 +01:00
|
|
|
end
|
2013-12-28 23:45:13 +01:00
|
|
|
end
|