Sha256: 77bdc15abe9de60c9b8c700e584869e6041fb28354f2e8914f99de7676d67d37

Contents?: true

Size: 851 Bytes

Versions: 1

Compression:

Stored size: 851 Bytes

Contents

describe "Element#after" do
  before do
    @div = Document.parse <<-HTML
      <div id="after-spec">
        <div id="some-header" class="kapow"></div>
        <div id="foo" class="after-spec-first"></div>
        <div id="bar" class="after-spec-first"></div>
        <div id="baz"></div>
      </div>
    HTML

    @div.append_to_body
  end

  after do
    @div.remove
  end

  it "should insert the given html string after each element" do
    el = Document['.after-spec-first']
    el.size.should == 2

    el.after '<p class="woosh"></p>'

    Document.id('foo').next.class_name.should == "woosh"
    Document.id('bar').next.class_name.should == "woosh"
  end

  it "should insert the given DOM element after this element" do
    Document.id('baz').after Document.id('some-header')
    Document.id('baz').next.id.should == "some-header"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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