Sha256: 29b8640ca7f2be35b9194b6b70c7f2af98fab2ce9f0d2d53fcdc63c59d07306a

Contents?: true

Size: 755 Bytes

Versions: 7

Compression:

Stored size: 755 Bytes

Contents

require "spec_helper"

RSpec.describe "Element#append" do
  html <<-HTML
    <div id="foo" class="first-append"></div>
    <div id="bar" class="first-append"></div>
    <div id="baz"></div>
    <div id="buz"></div>
  HTML

  it "should insert the HTML string to the end of each element" do
    Element.find('.first-append').append '<p class="woosh"></p>'

    Element.find('#foo').children.class_name.should == "woosh"
    Element.find('#bar').children.class_name.should == "woosh"
  end

  it "should insert the given DOM node at the end of the element" do
    baz = Element.find('#baz')
    buz = Element.find('#buz')

    baz.children.size.should == 0
    baz.append buz

    baz.children.size.should == 1
    baz.children.id.should == "buz"
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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