Sha256: a7026ad5d9659d71c7c80fc40ce7f19d98dba8c227048ae8b72e01d2f90f4480

Contents?: true

Size: 1.04 KB

Versions: 9

Compression:

Stored size: 1.04 KB

Contents

# frozen-string-literal: true
require 'spec_helper'

RSpec.describe 'CSS filter rendering', type: :render do
  it 'renders css filter' do
    expect(render_string(<<HAML)).to eq("<div>\n<style>\n  html { font-size: 12px; }\n</style>\n<span>hello</span>\n</div>\n")
%div
  :css
    html { font-size: 12px; }
  %span hello
HAML
  end

  it 'keeps indent' do
    expect(render_string(<<HAML)).to eq("<div>\n<style>\n  html {\n    font-size: 12px;\n  }\n</style>\n<span>hello</span>\n</div>\n")
%div
  :css
    html {
      font-size: 12px;
    }
  %span hello
HAML
  end

  it 'ignores empty filter' do
    expect(render_string(<<HAML)).to eq("<div>\n<span>hello</span>\n</div>\n")
%div
  :css
  %span hello
HAML
  end

  it 'parses string interpolation' do
    expect(render_string(<<'HAML')).to eq("<style>\n  html { font-size: 12px; }\n</style>\n")
:css
  html { font-size: #{10 + 2}px; }
HAML
  end

  it "doesn't escape in string interpolation" do
    expect(render_string(<<'HAML')).to eq("<style>\n  <span/>\n</style>\n")
:css
  #{'<span/>'}
HAML
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
faml-0.7.3 spec/render/filters/css_spec.rb
faml-0.7.2 spec/render/filters/css_spec.rb
faml-0.7.1 spec/render/filters/css_spec.rb
faml-0.7.0 spec/render/filters/css_spec.rb
faml-0.6.5 spec/render/filters/css_spec.rb
faml-0.6.4 spec/render/filters/css_spec.rb
faml-0.6.3 spec/render/filters/css_spec.rb
faml-0.6.2 spec/render/filters/css_spec.rb
faml-0.6.1 spec/render/filters/css_spec.rb