Sha256: 0fb704f695f9603b6d37e9fed1220242041cf50e28847e8b556651ce6fb46d17

Contents?: true

Size: 921 Bytes

Versions: 12

Compression:

Stored size: 921 Bytes

Contents

require 'spec_helper'

module CiteProc
  module Ruby

    describe 'Renderer#render_layout' do
      let(:renderer) { Renderer.new }

      let(:node) { CSL::Style::Layout.new }

      let(:item) {
        i = CiteProc::CitationItem.new(:id => 'ID-1')
        i.data = CiteProc::Item.new(:id => 'ID-1')
        i
      }

      it 'returns an empty string when empty' do
        expect(renderer.render(item, node)).to eq('')
      end

      describe 'with child nodes' do
        before(:each) do
          node << CSL::Style::Text.new(:value => 'foo')
          node << CSL::Style::Text.new(:value => 'bar')
        end

        it 'renders each child' do
          expect(renderer.render(item, node)).to eq('foobar')
        end

        it 'uses the delimiters if specified' do
          node[:delimiter] = '-'
          expect(renderer.render(item, node)).to eq('foo-bar')
        end
      end

    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
citeproc-ruby-1.1.8 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.7 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.6 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.5 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.4 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.3 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.2 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.1 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.1.0 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.0.6 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.0.5 spec/citeproc/ruby/renderer/layout_spec.rb
citeproc-ruby-1.0.4 spec/citeproc/ruby/renderer/layout_spec.rb