Skip to content

Commit c2d31fd

Browse files
committed
fix tests for react<16.0
1 parent 50364e3 commit c2d31fd

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

test/rendering.test.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,21 @@ describe('rendering', function () {
284284
'<span style={{sm}}>should have small font-size</span>'
285285
))
286286

287+
var styleEndsWithoutSemicolon = semver.gte(React.version, '16.0.0')
288+
287289
assert.equal(
288-
'<span style="font-size:10px">should have small font-size</span>',
290+
styleEndsWithoutSemicolon
291+
? '<span style="font-size:10px">should have small font-size</span>'
292+
: '<span style="font-size:10px;">should have small font-size</span>',
289293
ReactDOMServer.renderToStaticMarkup(
290294
React.createElement(tmpl, {sm: "font-size: 10px"})
291295
)
292296
)
293297

294298
assert.equal(
295-
'<span style="font-size:5%">should have small font-size</span>',
299+
styleEndsWithoutSemicolon
300+
? '<span style="font-size:5%">should have small font-size</span>'
301+
: '<span style="font-size:5%;">should have small font-size</span>',
296302
ReactDOMServer.renderToStaticMarkup(
297303
React.createElement(tmpl, {sm: "font-size: 5%"})
298304
)
@@ -303,14 +309,18 @@ describe('rendering', function () {
303309
))
304310

305311
assert.equal(
306-
'<span style="font-size:10px;color:red">should have small font-size</span>',
312+
styleEndsWithoutSemicolon
313+
? '<span style="font-size:10px;color:red">should have small font-size</span>'
314+
: '<span style="font-size:10px;color:red;">should have small font-size</span>',
307315
ReactDOMServer.renderToStaticMarkup(
308316
React.createElement(tmpl2, {sm: "font-size: 10px"})
309317
)
310318
)
311319

312320
assert.equal(
313-
'<span style="color:red">should have small font-size</span>',
321+
styleEndsWithoutSemicolon
322+
? '<span style="color:red">should have small font-size</span>'
323+
: '<span style="color:red;">should have small font-size</span>',
314324
ReactDOMServer.renderToStaticMarkup(
315325
React.createElement(tmpl2, {sm: ""})
316326
)

0 commit comments

Comments
 (0)