Sha256: 455c7170253c3b65e23486c98db015c055b9c835a8df521a77a1827af4ad02f5

Contents?: true

Size: 718 Bytes

Versions: 5

Compression:

Stored size: 718 Bytes

Contents

require "spec_helper"

describe "Element#before" do
  html <<-HTML
    <div id="some-header" class="kapow"></div>
    <div id="foo" class="before-spec-first"></div>
    <div id="bar" class="before-spec-first"></div>
    <div id="baz"></div>
  HTML

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

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

    Document['#foo'].prev.class_name.should == "woosh"
    Document['#bar'].prev.class_name.should == "woosh"
  end

  it "should insert the given DOM element before this element" do
    Document['#baz'].before Document['#some-header']
    Document['#baz'].prev.id.should == "some-header"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-jquery-0.0.6 spec/element/before_spec.rb
opal-jquery-0.0.5 spec/element/before_spec.rb
opal-jquery-0.0.4 spec/element/before_spec.rb
opal-jquery-0.0.3 spec/element/before_spec.rb
opal-jquery-0.0.2 spec/element/before_spec.rb