Sha256: f59c432661d71fb7ca993c32e53e8af3e661b42190be6f551bcc1022cc2fb424

Contents?: true

Size: 1.02 KB

Versions: 21

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

RSpec.describe 'Multiline rendering', type: :render do
  it 'handles multiline syntax' do
    expect(render_string(<<HAML)).to eq("<p>\nfoo bar baz\nquux\n</p>\n")
%p
  = "foo " + |
    "bar " + |   
    "baz"               |
  = "quux"
HAML
  end

  it 'handles multiline with non-script line' do
    expect(render_string(<<HAML)).to eq("<p>\nfoo \nbar\n</p>\n")
%p
  foo |  
  bar
HAML
  end

  it 'handles multiline at the end of template' do
    expect(render_string(<<HAML)).to eq("<p>\nfoo  bar baz \n</p>\n")
%p
  foo  |
bar |
  baz |
HAML
  end

  it 'is not multiline' do
    expect(render_string(<<HAML)).to eq("<div>\nhello\n|\nworld\n</div>\n")
%div
  hello
  |
  world
HAML
  end

  it 'can be used in attribute list' do
    expect(render_string(<<HAML)).to eq("<div bar='2' foo='1'></div>\n")
%div{foo: 1, |
  bar: 2}
HAML
  end

  it "isn't enabled in filter" do
    expect(render_string(<<HAML)).to eq("<script>\n  hello |\n  world |\n</script>\n4\n")
:javascript
  hello |
  world |
= __LINE__
HAML
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
faml-0.6.0 spec/render/multiline_spec.rb
faml-0.5.1 spec/render/multiline_spec.rb
faml-0.5.0 spec/render/multiline_spec.rb
faml-0.4.2 spec/render/multiline_spec.rb
faml-0.4.1 spec/render/multiline_spec.rb
faml-0.4.0 spec/render/multiline_spec.rb
faml-0.3.6 spec/render/multiline_spec.rb
faml-0.3.5 spec/render/multiline_spec.rb
faml-0.3.4 spec/render/multiline_spec.rb
faml-0.3.3 spec/render/multiline_spec.rb
faml-0.3.2 spec/render/multiline_spec.rb
faml-0.3.1 spec/render/multiline_spec.rb
faml-0.3.0 spec/render/multiline_spec.rb
faml-0.2.16 spec/render/multiline_spec.rb
faml-0.2.15 spec/render/multiline_spec.rb
faml-0.2.14 spec/render/multiline_spec.rb
faml-0.2.13 spec/render/multiline_spec.rb
faml-0.2.12 spec/render/multiline_spec.rb
faml-0.2.11 spec/render/multiline_spec.rb
faml-0.2.10 spec/render/multiline_spec.rb