Sha256: eac09e48536ff770a1ace03685c3527c7675e615a575677415b6d144c9bc8ec3
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
module React module Test module Matchers class RenderHTMLMatcher def initialize(expected) @expected = expected @params = {} end def with_params(params) @params = params self end def matches?(component) @component = component @actual = render_to_html @expected == @actual end def failure_message failure_string end def negative_failure_message failure_string(:negative) end private def render_to_html element = React.create_element(@component, @params) React.render_to_static_markup(element) end def failure_string(negative = false) str = "expected '#{@component.name}' with params '#{@params}' to " str = str + "not " if negative str = str + "render '#{@expected}', but '#{@actual}' was rendered." str end end def render_static_html(*args) RenderHTMLMatcher.new(*args) end def render(*args) %x{ console.error("Warning: `render` matcher is deprecated in favor of `render_static_html`."); } RenderHTMLMatcher.new(*args) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hyper-react-0.11.0 | lib/react/test/matchers/render_html_matcher.rb |