Sha256: 3ef5a5d17bc9f424a9ae1945ab1c4d9b9104afb6410ad25f633ee8a9423105bc

Contents?: true

Size: 1.52 KB

Versions: 3

Compression:

Stored size: 1.52 KB

Contents

require "spec_helper"

describe Jquery::Helpers do
  include ActionView::Helpers, ::ERB::Util, ActionView::Context
  include Jquery::Helpers


  it "offers default link" do
    link_to_modal("SimpleDialog", "http://www.google.de", :id => 1).should \
      eq('<a href="http://www.google.de" id="1" rel="modal:open">SimpleDialog</a>')
  end

  it "offers AJAX link" do
    link_to_modal("SimpleDialog", "http://www.google.de", :id => 1, :remote => true).should \
      eq('<a href="http://www.google.de" id="1" rel="modal:open:ajaxpost">SimpleDialog</a>')
  end

  it "supports block for default link" do
    link = link_to_modal("http://www.google.de", :id => 1) do
      "SimpleDialog"
    end

    link.should eq('<a href="http://www.google.de" id="1" rel="modal:open">SimpleDialog</a>')
  end

  it "supports block for AJAX link" do
    link = link_to_modal("http://www.google.de", :id => 1, :remote => true) do
      "SimpleDialog"
    end

    link.should eq('<a href="http://www.google.de" id="1" rel="modal:open:ajaxpost">SimpleDialog</a>')
  end

  it "supports block for complex AJAX link" do
    link = link_to_modal("http://www.google.de", :id => 1, :remote => true) do
      content_tag(:div) do
        content_tag(:p) do
          "SimpleDialog"
        end
      end
    end

    link.should eq('<a href="http://www.google.de" id="1" rel="modal:open:ajaxpost"><div><p>SimpleDialog</p></div></a>')
  end

  it "does not crash with only two paraemters" do
    link_to_modal('New User Modal', "http://google.de").should_not be_nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jquery-modal-rails-0.0.4 spec/jquery/modal/link_helpers_spec.rb
jquery-modal-rails-0.0.3 spec/jquery/modal/link_helpers_spec.rb
jquery-modal-rails-0.0.2 spec/jquery/modal/link_helpers_spec.rb