Sha256: a59fc07dbd9dcfcff1b6990216ab7a5d04bc67b2eecb9ba73fcda54cffd1d21b

Contents?: true

Size: 1.73 KB

Versions: 6

Compression:

Stored size: 1.73 KB

Contents

describe UnderOs::Parser::CSS do
  before do
    @parser  = UnderOs::Parser::CSS.new
  end

  it "should parse simple tags" do
    @parser.parse(%Q[
      page {
        background-color: darkgray;
      }
    ]).should == {'page' => {backgroundColor: "darkgray"}}
  end

  it "should unquote quoted values" do
    @parser.parse(%Q{
      page {
        background-image: "image.png";
      }
    }).should == {'page' => {backgroundImage: "image.png"}}
  end

  it "should parse heaps of styles" do
    @parser.parse(%Q{
      button {
        width:         79px;
        height:        79px;
        color:         black;
        background:    white;
        border-radius: 0px;
      }
    }).should == {'button' => {
      width: 79.0, height: 79.0, color: "black", backgroundColor: "white", borderRadius: 0.0
    }}
  end

  it "should parse classes" do
    @parser.parse(%Q[
      .row1 { bottom: 0px;   }
      .row2 { bottom: 80px;  }

      .col1.col2 { left: 0;  }
    ]).should == {
      '.row1' => {bottom: 0.0},
      '.row2' => {bottom: 80.0},
      '.col1.col2' => {left: 0.0}
    }
  end

  it "should parse tags and styles" do
    @parser.parse(%Q[
      button.double { width: 159; }
      button.ops    { background: yellow }
    ]).should == {
      'button.double' => {width: 159.0},
      'button.ops'    => {backgroundColor: "yellow"}
    }
  end

  it "should parse complex rules" do
    @parser.parse(%Q{
      icon#delete .col1.col2 { color: red }
    }).should == {
      'icon#delete .col1.col2' => {color: "red"}
    }
  end

  it "should parse several rules" do
    @parser.parse(%Q{
      input, textarea {
        width: 100;
      }
    }).should == {
      'input'    => {width: 100.0},
      'textarea' => {width: 100.0}
    }
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
under-os-ui-1.4.0 spec/under_os/parser/css_spec.rb
under-os-1.3.0 spec/lib/under_os/parser/css_spec.rb
under-os-1.2.1 spec/lib/under_os/parser/css_spec.rb
under-os-1.2.0 spec/lib/under_os/parser/css_spec.rb
under-os-1.1.0 spec/lib/under_os/parser/css_spec.rb
under-os-1.0.0 spec/lib/under_os/parser/css_spec.rb