Sha256: 3281469980c4e9ac0313cd1836b87de9d92de288890d96fc38a93711595a4248

Contents?: true

Size: 949 Bytes

Versions: 7

Compression:

Stored size: 949 Bytes

Contents

require "spec_helper"

RSpec.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

7 entries across 7 versions & 1 rubygems

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