Sha256: d8d71ff5f56af049731284d974d592a0483b5e991d4b4f96900d994231bb419d
Contents?: true
Size: 1.96 KB
Versions: 7
Compression:
Stored size: 1.96 KB
Contents
describe Hamlit::Engine do describe 'script' do it 'renders one-line script' do assert_render(<<-HAML, <<-HTML) = 1 + 2 %span= 3 * 4 HAML 3 <span>12</span> HTML end it 'renders one-line script with comment' do assert_render(<<-HAML, <<-HTML) = # comment_only = '#' + "#" # = 3 # = ['#', "#"] # comment HAML ## ["#", "#"] HTML end it 'renders multi-lines script' do assert_render(<<-HAML, <<-HTML) %span = 1 + 2 4 / 2 %a= 3 - 4 HAML <span> 3 4 / 2 <a>-1</a> </span> HTML end it 'renders block script' do assert_render(<<-HAML, <<-HTML) = 3.times do |i| = i 4 HAML 0 1 2 3 4 HTML end it 'renders tag internal block script' do assert_render(<<-HAML, <<-HTML) %span = 1.times do |i| = i HAML <span> 0 1 </span> HTML end it 'accepts a continuing script' do assert_render(<<-HAML, <<-HTML) - def foo(a, b); a + b; end = foo(1, 2) HAML 3 HTML end it 'renders !=' do assert_render(<<-HAML, <<-HTML, escape_html: true) != '<"&>' != '<"&>'.tap do |str| -# no operation HAML <"&> <"&> HTML end it 'renders &=' do assert_render(<<-HAML, <<-HTML, escape_html: false) &= '<"&>' &= '<"&>'.tap do |str| -# no operation HAML <"&> <"&> HTML end it 'regards ~ operator as =' do assert_render(<<-'HAML', <<-HTML) ~ "<code>hello\nworld</code>" HAML <code>hello world</code> HTML end end end
Version data entries
7 entries across 7 versions & 1 rubygems