Sha256: 804a92c28a8954fa433cea42ebb57a1e46c681ba278352b9151daf739d6b3997

Contents?: true

Size: 1.56 KB

Versions: 4

Compression:

Stored size: 1.56 KB

Contents

require 'helper'

describe BeautifulCss::Engine do

  it 'nothing to nothing' do
    assert_renders '', ''
  end



  it 'vanila style' do
    dirty = <<D
a
{ color:red }
D
    assert_renders dirty, dirty
  end





  it 'should work with three styles' do
    dirty = <<DIRTY
a
{
  color:red;
  background-color:blue;
}

.classy
{
  color:green;
}
DIRTY
    clean = <<CLEAN
a
{ background-color:blue }

.classy
{ color:green }

a
{ color:red }
CLEAN
    assert_renders dirty, clean
  end



  it 'should be alphabetical' do
    dirty = <<DIRTY
a
{ color:red }

a
{ background-color:blue }

DIRTY
    clean = <<CLEAN
a
{ background-color:blue }

a
{ color:red }
CLEAN
    assert_renders dirty, clean
  end






  it 'should be able to handle scss' do
    dirty = <<DIRTY
.classy {
  a
  { color:red }
}
DIRTY
    clean = <<CLEAN
.classy a
{ color:red }
CLEAN
    assert_renders dirty, clean
  end




  it 'should remove dups' do
    dirty = <<DIRTY
a { color:red }
a { color:red }
DIRTY
    clean = <<CLEAN
a
{ color:red }
CLEAN
    assert_renders dirty, clean
  end




  it 'should removed unset values' do
    dirty = <<DIRTY
a { color:green }
a { color:red }
DIRTY
    clean = <<CLEAN
a
{ color:red }
CLEAN
    assert_renders dirty, clean
  end



  it 'should group selectors' do
    dirty = <<DIRTY
a { color:green }
b { color:green }
DIRTY
    clean = <<CLEAN
a,
b
{ color:green }
CLEAN
    assert_renders dirty, clean
  end



  def assert_renders(dirty,clean)
    assert_equal clean.strip, convert(dirty).strip
  end

  def convert(css)
    BeautifulCss::Engine.new(css).render
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
beautiful-css-0.0.8 spec/convertions_spec.rb
beautiful-css-0.0.6 spec/convertions_spec.rb
beautiful-css-0.0.5 spec/convertions_spec.rb
beautiful-css-0.0.4 spec/convertions_spec.rb