Sha256: dcd0597d02cb8de39e1111ceef2fdfde8b54360f1320b1435a81c4690434768d

Contents?: true

Size: 1.21 KB

Versions: 33

Compression:

Stored size: 1.21 KB

Contents

require 'spec_helper'

if ruby?
RSpec.describe ReactiveRuby::ServerRendering::ContextualRenderer do
  let(:renderer) { described_class.new({}) }
  let(:init) { Proc.new {} }
  let(:options) { { context_initializer: init } }

  describe '#render' do
    it 'pre-renders HTML' do
      result = renderer.render('Components.Todo',
                                { todo: 'finish reactive-ruby' },
                                options)
      expect(result).to match(/<li.*>finish reactive-ruby<\/li>/)
      expect(result).to match(/data-react-checksum/)
    end

    it 'accepts props as a string' do
      result = renderer.render('Components.Todo',
                                { todo: 'finish reactive-ruby' }.to_json,
                                options)
      expect(result).to match(/<li.*>finish reactive-ruby<\/li>/)
      expect(result).to match(/data-react-checksum/)
    end

    it 'pre-renders static content' do
      result = renderer.render('Components.Todo',
                                { todo: 'finish reactive-ruby' },
                                :static)
      expect(result).to match(/<li.*>finish reactive-ruby<\/li>/)
      expect(result).to_not match(/data-react-checksum/)
    end
  end
end
end

Version data entries

33 entries across 33 versions & 3 rubygems

Version Path
hyper-react-0.12.7 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.12.6 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.12.5 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.12.4 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.12.3 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.12.2 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.12.1 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.12.0 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.11.0 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
hyper-react-0.10.0 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.9.0 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.8 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.7 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.6 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.5 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.4 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.3 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.1 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.8.0 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb
reactrb-0.7.42 spec/reactive-ruby/server_rendering/contextual_renderer_spec.rb