Sha256: 4f8f237bba1582b28bb6a1da72112aa379be1015bdbb8cd32c996a826ae91219

Contents?: true

Size: 943 Bytes

Versions: 6

Compression:

Stored size: 943 Bytes

Contents

require "spec_helper"

describe "Element#inspect" do
  html <<-HTML
    <div id="foo"></div>
    <div class="bar"></div>
    <p id="lol" class="bar"></div>
  HTML

  it "returns a string representation of the elements" do
    Element.find('#foo').inspect.should == '#<Element [<div id="foo">]>'
    Element.find('.bar').inspect.should == '#<Element [<div class="bar">, <p id="lol" class="bar">]>'
  end

  it "returns '[]' when called on empty element set" do
    Element.find('.inspect-spec-none').inspect.should == '#<Element []>'
  end

  it "returns '[]' when called on empty element set" do
    Element.find('.inspect-spec-none').inspect.should == '#<Element []>'
  end

  it "returns '[document]' when called on $(document)" do
    Element.find(`document`).inspect.should == '#<Element [document]>'
  end

  it "returns '[window]' when called on $(window)" do
    Element.find(`window`).inspect.should == '#<Element [window]>'
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-jquery-0.4.2 spec/element/inspect_spec.rb
opal-jquery-0.4.1 spec/element/inspect_spec.rb
opal-jquery-0.4.0 spec/element/inspect_spec.rb
opal-jquery-0.3.0 spec/element/inspect_spec.rb
opal-jquery-0.3.0.beta2 spec/element/inspect_spec.rb
opal-jquery-0.3.0.beta1 spec/element/inspect_spec.rb