Sha256: 0ebd9a17bae3c0a00a1237ad59b781d56462bcefc6277f4d78eda67c322ac4a0

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

require "spec_helper"

RSpec.describe "Element height and width" do
  html <<-HTML
    <div id="dimensions" style='width: 100px; height: 200px'></div>
  HTML

  describe '#height' do
    it "should grab height of existing element" do
      elm = Element.id('dimensions')

      expect(elm.height).to eq(200)
    end

    it "should return nil if item does not exist" do
      elm = Element.find('#not-an-elm')

      expect(elm.height).to eq(nil)
    end
  end

  describe '#height=' do
    it "should allow us to set height" do
      elm = Element.id('dimensions')
      elm.height = 121

      expect(elm.height).to eq(121)
    end
  end

  describe '#width' do
    it "should grab width of existing element" do
      elm = Element.id('dimensions')

      expect(elm.width).to eq(100)
    end

    it "should return nil if item does not exist" do
      elm = Element.find('#not-an-elm')

      expect(elm.width).to eq(nil)
    end
  end

  describe '#width=' do
    it "should allow us to set width" do
      elm = Element.id('dimensions')
      elm.width = 121

      expect(elm.width).to eq(121)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
opal-jquery-0.5.2 spec-opal/element/height_width_spec.rb
opal-jquery-0.5.1 spec-opal/element/height_width_spec.rb
opal-jquery-0.5.0 spec-opal/element/height_width_spec.rb
opal-jquery-0.4.6 spec-opal/element/height_width_spec.rb
opal-jquery-0.4.5 spec-opal/element/height_width_spec.rb
opal-jquery-0.4.4 spec-opal/element/height_width_spec.rb
opal-jquery-0.4.3 spec-opal/element/height_width_spec.rb