Sha256: 497d673f89eb1a8491dfc18236e08b2fb90f3fc30458436a352e7a1d722424d4

Contents?: true

Size: 1.88 KB

Versions: 8

Compression:

Stored size: 1.88 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Twitter::Bootstrap::Markup::Rails::Helpers::ModalHelpers do
  include BootstrapSpecHelper
  include BootstrapModalMacros

  describe "#bootstrap_modal" do
    before do
      @output_buffer = ''
      build_bootstrap_modal(:dom_id => "an_id", :fade => true, :header_title => "a title") do |modal|
        modal.body do |body|
          body.content_tag :div, "the body"
        end
        modal.footer do |footer|
          footer.content_tag :div, "the footer"
        end
      end      
    end
    
    it "should create a modal popup with header, body and footer" do
      output_buffer.should have_tag('div.modal') do |div|
        div.should have_tag('div.modal-header')
        div.should have_tag('div.modal-body')
        div.should have_tag('div.modal-footer')
      end
    end
    
    it "should create a modal popup with the given DOM ID" do
      output_buffer.should have_tag('div.modal#an_id')
    end

    it "should create a modal popup with the CSS class set if fade was passed" do
      output_buffer.should have_tag('div.modal.fade#an_id')
    end

    it "should create a modal popup with the given header title" do
      output_buffer.should have_tag('div.modal#an_id') do |div|
        div.should have_tag("h3", :text => "a title")
      end
    end
    
    it "should create a modal popup with the given body content placed" do
      output_buffer.should have_tag('div.modal#an_id') do |div|
        div.should have_tag("div.modal-body") do |body|
          body.should have_tag("div", :text => "the body")
        end
      end
    end

    it "should create a modal popup with the given footer content placed" do
      output_buffer.should have_tag('div.modal#an_id') do |div|
        div.should have_tag("div.modal-footer") do |body|
          body.should have_tag("div", :text => "the footer")
        end
      end
    end
    
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
twitter-bootstrap-markup-rails-0.3.2.2 spec/helpers/modal_helpers_spec.rb
twitter-bootstrap-markup-rails-0.3.2.1 spec/helpers/modal_helpers_spec.rb
twitter-bootstrap-markup-rails-0.3.2 spec/helpers/modal_helpers_spec.rb
bootstrap-shoehorn-1.0.2 spec/helpers/modal_helpers_spec.rb
bootstrap-shoehorn-1.0.1 spec/helpers/modal_helpers_spec.rb
bootstrap-shoehorn-1.0.0 spec/helpers/modal_helpers_spec.rb
twitter-bootstrap-markup-rails-0.3.1 spec/helpers/modal_helpers_spec.rb
twitter-bootstrap-markup-rails-0.3.0 spec/helpers/modal_helpers_spec.rb