Sha256: cea9385654433fbb77f5181d6a5680ac0c4e687412a38508e84cbddb0facccfa

Contents?: true

Size: 664 Bytes

Versions: 3

Compression:

Stored size: 664 Bytes

Contents

require 'spec_helper'

describe Rpub::Epub::HtmlToc do
  let(:outline) { [] }
  let(:book)    { double('book', :outline => outline) }
  let(:subject) { described_class.new(book).render }

  it { should have_xpath('/div/h1[text()="Table of Contents"]') }
  it { should have_xpath('/div/div[@class="toc"]') }

  context 'without headings in the outline' do
    it { should_not have_xpath('//a') }
  end

  context 'with heading in the outline' do
    let(:outline) { [['foo.html', [double('heading', :text => 'link', :html_id => 'bar', :level => 1)]]] }
    it { should have_xpath('/div/div/div[@class="level-1"]/a[@href="foo.html#bar"][text()="link"]') }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rpub-0.4.0 spec/rpub/epub/html_toc_spec.rb
rpub-0.3.0 spec/rpub/epub/html_toc_spec.rb
rpub-0.2.1 spec/rpub/epub/html_toc_spec.rb