Skip to content

Commit

Permalink
fix tests for react<16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zemlanin committed Oct 2, 2018
1 parent 50364e3 commit c2d31fd
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions test/rendering.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,21 @@ describe('rendering', function () {
'<span style={{sm}}>should have small font-size</span>'
))

var styleEndsWithoutSemicolon = semver.gte(React.version, '16.0.0')

assert.equal(
'<span style="font-size:10px">should have small font-size</span>',
styleEndsWithoutSemicolon
? '<span style="font-size:10px">should have small font-size</span>'
: '<span style="font-size:10px;">should have small font-size</span>',
ReactDOMServer.renderToStaticMarkup(
React.createElement(tmpl, {sm: "font-size: 10px"})
)
)

assert.equal(
'<span style="font-size:5%">should have small font-size</span>',
styleEndsWithoutSemicolon
? '<span style="font-size:5%">should have small font-size</span>'
: '<span style="font-size:5%;">should have small font-size</span>',
ReactDOMServer.renderToStaticMarkup(
React.createElement(tmpl, {sm: "font-size: 5%"})
)
Expand All @@ -303,14 +309,18 @@ describe('rendering', function () {
))

assert.equal(
'<span style="font-size:10px;color:red">should have small font-size</span>',
styleEndsWithoutSemicolon
? '<span style="font-size:10px;color:red">should have small font-size</span>'
: '<span style="font-size:10px;color:red;">should have small font-size</span>',
ReactDOMServer.renderToStaticMarkup(
React.createElement(tmpl2, {sm: "font-size: 10px"})
)
)

assert.equal(
'<span style="color:red">should have small font-size</span>',
styleEndsWithoutSemicolon
? '<span style="color:red">should have small font-size</span>'
: '<span style="color:red;">should have small font-size</span>',
ReactDOMServer.renderToStaticMarkup(
React.createElement(tmpl2, {sm: ""})
)
Expand Down

0 comments on commit c2d31fd

Please sign in to comment.