Sha256: 29aa1e84c87561034f28bf44526d7922dc3554b2f9a54134f346f44212062c94

Contents?: true

Size: 1.03 KB

Versions: 5

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

require "spec_helper"

describe Kitabu::Exporter::PDF, prince: Kitabu::Dependency.prince? do
  let(:root) { SPECDIR.join("support/mybook") }

  before do
    Kitabu::Exporter::HTML.new(root).export
    Kitabu::Exporter::PDF.new(root).export
  end

  it "creates html with css identifier" do
    expect(root.join("output/mybook.pdf.html").read).to have_tag("html.pdf")
    expect(root.join("output/mybook.print.html").read).to have_tag("html.print")
  end

  it "sets stylesheet for print pdf" do
    selector = 'link[rel=stylesheet][href="styles/print.css"]'
    expect(root.join("output/mybook.print.html").read).to have_tag(selector)
  end

  it "sets stylesheet for pdf" do
    selector = 'link[rel=stylesheet][href="styles/pdf.css"]'
    expect(root.join("output/mybook.pdf.html").read).to have_tag(selector)
  end

  it "generates pdf file for print" do
    expect(root.join("output/mybook.print.pdf")).to be_file
  end

  it "generates pdf file" do
    expect(root.join("output/mybook.pdf")).to be_file
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kitabu-3.1.0 spec/kitabu/exporter/pdf_spec.rb
kitabu-3.0.3 spec/kitabu/exporter/pdf_spec.rb
kitabu-3.0.2 spec/kitabu/exporter/pdf_spec.rb
kitabu-3.0.1 spec/kitabu/exporter/pdf_spec.rb
kitabu-3.0.0 spec/kitabu/exporter/pdf_spec.rb