Sha256: 3b8303b3663dfc37f8aca036b80145bd5fe076c0a3edf7f8e6be189be33c1ae1

Contents?: true

Size: 1.31 KB

Versions: 10

Compression:

Stored size: 1.31 KB

Contents

require "test_helper"

module Csscss::Parser
  module Padding
    describe Padding do
      include CommonParserTests

      before do
        @parser = Parser.new
        @trans = Transformer.new
      end

      it "converts shorthand rules to longhand" do
        trans("1px 10% inherit 4em").must_equal([
          dec("padding-top", "1px"),
          dec("padding-right", "10%"),
          dec("padding-bottom", "inherit"),
          dec("padding-left", "4em")
        ])

        trans("1px 10% inherit").must_equal([
          dec("padding-top", "1px"),
          dec("padding-right", "10%"),
          dec("padding-bottom", "inherit"),
          dec("padding-left", "10%")
        ])

        trans("1px 10%").must_equal([
          dec("padding-top", "1px"),
          dec("padding-right", "10%"),
          dec("padding-bottom", "1px"),
          dec("padding-left", "10%")
        ])

        trans("1px").must_equal([
          dec("padding-top", "1px"),
          dec("padding-right", "1px"),
          dec("padding-bottom", "1px"),
          dec("padding-left", "1px")
        ])
      end

      it "tries the parse and returns false if it doesn't work" do
        @parser.try_parse("foo").must_equal(false)
        parsed = @parser.try_parse("1px")
        parsed[:padding][:top].must_equal("1px")
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
csscss-1.3.3 test/csscss/parser/padding_test.rb
csscss-1.3.2 test/csscss/parser/padding_test.rb
csscss-1.3.1 test/csscss/parser/padding_test.rb
csscss-1.3.0 test/csscss/parser/padding_test.rb
csscss-1.2.0 test/csscss/parser/padding_test.rb
csscss-1.1.0 test/csscss/parser/padding_test.rb
csscss-1.0.0 test/csscss/parser/padding_test.rb
csscss-0.2.1 test/csscss/parser/padding_test.rb
csscss-0.2.0 test/csscss/parser/padding_test.rb
csscss-0.1.0 test/csscss/parser/padding_test.rb