require 'spec_helper'
if opal?
describe React::Test::Matchers::RenderHTMLMatcher do
let(:component) {
Class.new do
include React::Component
params do
optional :string
end
def render
div do
span { params.string } if params.string
'lorem'
end
end
end
}
let(:expected) { '
lorem<\/div>'
matcher.matches?(component)
expect(matcher.failure_message).to match(/, but '#{actual}' was rendered/)
end
it 'does not include "to not render"' do
matcher.matches?(component)
expect(matcher.failure_message).to_not match(/to not render/)
end
end
describe '#negative_failure_message' do
let(:expected) { '
strlorem
' }
it 'includes "to not render"' do
matcher.matches?(component)
expect(matcher.negative_failure_message).to match(/to not render/)
end
end
end
end