# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Newline with > and <', type: :render do describe '>' do it 'parses nuke-outer-whitespace (>)' do expect(render_string(<hello\n") %img %span> hello %img HAML expect(render_string(<\n1hoge\n") %div %span= 1 %span> hoge HAML end it 'handles silent script' do expect(render_string(<01\n") %div - 2.times do |i| %span>= i HAML end it 'handles comment' do expect(render_string(<\n\n\n") %div / - 2.times do |i| %span>= i HAML end it 'handles conditional comment' do expect(render_string(<\n\n\n") %div / [if IE] - 2.times do |i| %span>= i HAML end end describe '>' do it 'parses nuke-inner-whitespace (<)' do expect(render_string(<
\nFoo!\n
\n") %blockquote< %div Foo! HAML end it 'renders pre tag as nuke-inner-whitespace by default' do expect(render_string(<hello\nworld\n") %pre hello world HAML end it 'handles silent script' do expect(render_string(<012\n") %div< - 3.times do |i| = i HAML end it 'parses texts correctly' do expect(render_string('%div{foo: :bar} hello')).to eq("
hello
\n") expect(render_string('%div(foo="bar") hello')).to eq("
hello
\n") end end describe '><' do it 'parses nuke-whitespaces' do expect(render_string(<
foo\nbar
\n") %img %pre>< foo bar %img HAML end it 'allows double rmnl' do expect(render_string(<hello') %div>< %span><= 'hello' HAML end end end