Sha256: b08e9f197643af2b1a381df19ea58b0b1f6e8787e6723e137b9fb0c6097c9a7f

Contents?: true

Size: 742 Bytes

Versions: 16

Compression:

Stored size: 742 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 = Element.find('.before-spec-first')
    el.size.should == 2

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

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

  it "should insert the given DOM element before this element" do
    Element.find('#baz').before Element.find('#some-header')
    Element.find('#baz').prev.id.should == "some-header"
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
opal-jquery-0.4.2 spec/element/before_spec.rb
opal-jquery-0.4.1 spec/element/before_spec.rb
opal-jquery-0.4.0 spec/element/before_spec.rb
opal-jquery-0.3.0 spec/element/before_spec.rb
opal-jquery-0.3.0.beta2 spec/element/before_spec.rb
opal-jquery-0.3.0.beta1 spec/element/before_spec.rb
opal-jquery-0.2.0 spec/element/before_spec.rb
opal-jquery-0.1.2 spec/element/before_spec.rb
opal-jquery-0.1.1 spec/element/before_spec.rb
opal-jquery-0.1.0 spec/element/before_spec.rb
opal-jquery-0.0.13 spec/element/before_spec.rb
opal-jquery-0.0.12 spec/element/before_spec.rb
opal-jquery-0.0.11 spec/element/before_spec.rb
opal-jquery-0.0.9 spec/element/before_spec.rb
opal-jquery-0.0.8 spec/element/before_spec.rb
opal-jquery-0.0.7 spec/element/before_spec.rb