Sha256: c0435e6fd0460abd8194cb5e1ce485f13d7740831f18af5a158d439db59b9944

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

# encoding: utf-8
require_relative 'support/common'

describe 'Serialization' do
  make_my_diffs_pretty!
  parallelize_me!

  # Parse a bunch of real-world CSS and make sure it's the same when we
  # serialize it.
  Dir[File.join(File.dirname(__FILE__), 'support/serialization/*.css')].each do |filepath|
    it "should parse and serialize #{filepath}" do
      input = File.read(filepath)

      tree = Crass.parse(input,
        :preserve_comments => true,
        :preserve_hacks => true)

      assert_equal(input, CP.stringify(tree))
    end
  end

  # -- Regression tests --------------------------------------------------------
  it "should not omit a trailing semicolon when serializing a `@charset` rule" do
    css  = '@charset "utf-8";'
    tree = Crass.parse(css)

    assert_equal(css, CP.stringify(tree))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
crass-1.0.0 test/test_serialization.rb