Sha256: ed8b951fa2e7c39d6116ff8db8212a18ae90ee1c8a1d61c1fb291d932ff19d58

Contents?: true

Size: 1.36 KB

Versions: 1

Compression:

Stored size: 1.36 KB

Contents

describe "Element#css" do
  before do
    @div = Document.parse <<-HTML
      <div id="css-spec">
        <div id="foo" style="background-color:rgb(15,99,30); color:;"></div>
        <div id="bar"></div>
        <div id="hash"></div>
      </div>
    HTML

    @div.append_to_body
  end

  after do
    @div.remove
  end

  describe "with a given name" do
    it "returns the value of the CSS property for the given name" do
      Document.id('foo').css('backgroundColor').should be_kind_of(String)
    end

    it "should return an empty string when no style property is defined for name" do
      Document.id('foo').css('color').should be_kind_of(String)
    end
  end

  describe "with a name and value" do
    it "should set the CSS property to the given value" do
      Document.id('bar').css('backgroundColor', 'blue')
    end

    it "returns self" do
      bar = Document.id('bar')
      bar.css("background", "green").should equal(bar)
    end
  end

  describe "with a set of names and values" do
    it "should set the properties" do
      hash = Document.id("hash")
      hash.css(:width => "100px", :height => "200px")
      hash.css("width").should be_kind_of(String) 
      hash.css("height").should be_kind_of(String) 
    end

    it "should return self" do
      hash = Document.id("hash")
      hash.css(:border => "1px solid #000").should equal(hash)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-jquery-0.0.1 spec/element/css_spec.rb