Skip to content

Commit

Permalink
Fix tests for React 15 and 16
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewnham committed Aug 9, 2017
1 parent b3593aa commit ddf8a08
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/integration/integration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import ReactDOMServer from 'react-dom/server';
import HtmlParser from 'HtmlParser';

const reactVersion = parseInt(require('react/package.json').version.match(/^(\d+)\./)[1], 10);

class HtmlParserComponent extends React.Component {
render() {
return <div>{HtmlParser(this.props.html)}</div>;
Expand Down Expand Up @@ -59,7 +61,11 @@ describe('Integration tests: ', () => {
});

it('should handle inline styles', () => {
test('<div style="border-radius:1px;background:red">test</div>');

// react 16 drops trailing semi commas from inline styles so we have to test for both
const trailingSemiComma = reactVersion === 15 ? ';' : '';

test(`<div style="border-radius:1px;background:red${trailingSemiComma}">test</div>`);
});

it('should transform a html tag to a div', () => {
Expand Down

0 comments on commit ddf8a08

Please sign in to comment.