Sha256: c8ffbd281fa9fdcfc4af255181fa1638d22dbb855c2a680c4b8c1f7d49f7055b

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

require_relative '../../spec_helper'

describe Tabulous::BootstrapPillRenderer do
  include Tabulous::TestData

  before(:each) do
    create_sample_tabset
    @renderer = Tabulous::BootstrapPillRenderer.new(@tabset, @view)
  end

  it "should return Bootstrap HTML for tabs with a nav-pills class" do
    tabs_html = @renderer.tabs_html
    tabs_html.should be_a(String)
    expect(tabs_html).to match(/<ul class="nav nav-pills">/)
    expect(tabs_html).to_not match(/<ul class="nav nav-tabs">/)
    expect(tabs_html).to_not match(/<div class="tabs">/)
  end

  it "should not show invisible tabs" do
    expect(@renderer.tabs_html).to_not match(/cookies/)
  end

  it "should have the correct HTML for disabled tabs" do
    expect(@renderer.tabs_html).to match(/<li class="disabled"><a>cupcakes<\/a><\/li>/)
  end

  it "should return the expected HTML" do
    tabs_html = @renderer.tabs_html
    expected_html = <<-HTML.strip_heredoc
      <ul class="nav nav-pills">
        <li><a href="/cakes">cakes</a></li><li class="disabled"><a>cupcakes</a></li><li class="active dropdown"><a class="dropdown-toggle" data-toggle="dropdown" href="#">breads<b class="caret"></b></a><ul class="dropdown-menu"><li><a href="/breads/spoonbread">spoonbread</a></li><li><a href="/breads/banana-bread">banana bread</a></li></ul></li>
      </ul>
    HTML
    tabs_html.should == expected_html
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tabulous-2.0.0 spec/lib/tabulous/bootstrap_pill_renderer_spec.rb