Sha256: bfc8127d29f4ec9fbb8b83381ebe457e7675efcefc781af24f1de93597a3d441

Contents?: true

Size: 1.18 KB

Versions: 13

Compression:

Stored size: 1.18 KB

Contents

require 'spec_helper'

RSpec.describe 'Comment rendering', type: :render do
  it 'renders html comment' do
    expect(render_string('/ comments')).to eq("<!-- comments -->\n")
  end

  it 'strips spaces' do
    expect(render_string('/   comments   ')).to eq("<!-- comments -->\n")
  end

  it 'renders structured comment' do
    expect(render_string(<<HAML)).to eq("<span>hello</span>\n<!--\ngreat\n-->\n<span>world</span>\n")
%span hello
/
  great
%span world
HAML
  end

  it 'renders comment with interpolation' do
    expect(render_string(<<'HAML')).to eq("<span>hello</span>\n<!--\ngreat\n-->\n<span>world</span>\n")
- comment = 'great'
%span hello
/
  #{comment}
%span world
HAML
  end

  it 'renders conditional comment' do
    expect(render_string('/ [if IE] hello')).to eq("<!--[if IE]> hello <![endif]-->\n")
  end

  it 'renders conditional comment with children' do
    expect(render_string(<<HAML)).to eq("<!--[if IE]>\n<span>hello</span>\nworld\n<![endif]-->\n")
/[if IE]
  %span hello
  world
HAML
  end

  it 'parses nested conditional comment' do
    expect(render_string(<<HAML)).to eq("<!--[[if IE]]>\n<span>hello</span>\nworld\n<![endif]-->\n")
/[[if IE]]
  %span hello
  world
HAML
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
faml-0.6.0 spec/render/comment_spec.rb
faml-0.5.1 spec/render/comment_spec.rb
faml-0.5.0 spec/render/comment_spec.rb
faml-0.4.2 spec/render/comment_spec.rb
faml-0.4.1 spec/render/comment_spec.rb
faml-0.4.0 spec/render/comment_spec.rb
faml-0.3.6 spec/render/comment_spec.rb
faml-0.3.5 spec/render/comment_spec.rb
faml-0.3.4 spec/render/comment_spec.rb
faml-0.3.3 spec/render/comment_spec.rb
faml-0.3.2 spec/render/comment_spec.rb
faml-0.3.1 spec/render/comment_spec.rb
faml-0.3.0 spec/render/comment_spec.rb