Sha256: 5e78c205cd5bd4ded4b331eaf314e48325720a9aa260345b25e254b067fa8131

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

require 'spec_helper'

mock_node = {"content" => [{"value" => "foo", "nodeType" => "text"}]}

mock_node_with_marks = {"content" => [{"value" => "foo", "nodeType" => "text", "marks" => [{"type" => "bold"}]}]}

describe StructuredTextRenderer::BaseBlockRenderer do
  subject do
    described_class.new(
      'text' => StructuredTextRenderer::TextRenderer,
      'bold' => StructuredTextRenderer::BoldRenderer,
      'italic' => StructuredTextRenderer::ItalicRenderer,
      'underline' => StructuredTextRenderer::UnderlineRenderer
    )
  end

  describe '#render' do
    it 'by defaults renders a div' do
      expect(subject.render(mock_node)).to eq "<div>foo</div>"
    end

    it 'will propagate marks to text renderers' do
      expect(subject.render(mock_node_with_marks)).to eq "<div><b>foo</b></div>"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
structured_text_renderer-0.0.2 spec/lib/structured_text_renderer/block_renderers/base_block_renderer_spec.rb
structured_text_renderer-0.0.1 spec/lib/structured_text_renderer/block_renderers/base_block_renderer_spec.rb