Sha256: 84d198bc93324f12644e99553befb5c4ff30888ce6125b4e0da27236a38437e4

Contents?: true

Size: 1.21 KB

Versions: 16

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'
describe AccordionBuilderHelper, type: :helper do
  let(:pane) { Struct.new(:title, :content) }
  let(:first_pane) { pane.new('Hello World', 'Good-Bye')}
  let(:second_pane) { pane.new('Something', 'Different')}
  it 'renders' do
    rendered = accordion do |set|
      set.pane(first_pane.title, open_next: 'true') do
        first_pane.content
      end +
      set.pane(second_pane.title) do
        second_pane.content
      end
    end

    expect(rendered).to have_tag('#accordion.accordion') do
      with_tag('.accordion-group') do
        with_tag('.accordion-heading a[href="#accordion-fieldset-0"]', text: first_pane.title)
        with_tag('.accordion-body.collapse.in#accordion-fieldset-0') do
          with_tag('.accordion-inner') do
            with_tag('div', text: first_pane.content)
            with_tag('.row a.continue[href="#accordion-fieldset-1"]')
          end
        end
        with_tag('.accordion-heading a[href="#accordion-fieldset-1"]', text: second_pane.title)
        with_tag('.accordion-body.collapse.in#accordion-fieldset-1') do
          with_tag('.accordion-inner') do
            with_tag('div', text: second_pane.content)
          end
        end
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
curate-0.6.6 spec/builders/accordion_builder_helper_spec.rb
curate-0.6.5 spec/builders/accordion_builder_helper_spec.rb
curate-0.6.4 spec/builders/accordion_builder_helper_spec.rb
curate-0.6.3 spec/builders/accordion_builder_helper_spec.rb
curate-0.6.1 spec/builders/accordion_builder_helper_spec.rb
curate-0.6.0 spec/builders/accordion_builder_helper_spec.rb
curate-0.5.6 spec/builders/accordion_builder_helper_spec.rb
curate-0.5.5 spec/builders/accordion_builder_helper_spec.rb
curate-0.5.4 spec/builders/accordion_builder_helper_spec.rb
curate-0.5.2 spec/builders/accordion_builder_helper_spec.rb
curate-0.5.1 spec/builders/accordion_builder_helper_spec.rb
curate-0.5.0 spec/builders/accordion_builder_helper_spec.rb
curate-0.4.2 spec/builders/accordion_builder_helper_spec.rb
curate-0.3.2 spec/builders/accordion_builder_helper_spec.rb
curate-0.3.1 spec/builders/accordion_builder_helper_spec.rb
curate-0.2.0 spec/builders/accordion_builder_helper_spec.rb