UNPKG

style-it

Version:

Component for writing plaintext CSS in React apps -- isomorphic, scoped, FOUC-free, fully featured, CSS-in-JS

38 lines (27 loc) 1.05 kB
import React from 'react'; import { findDOMNode, render } from 'react-dom'; import TestUtils from 'react-addons-test-utils'; const removeNewlines = (string) => (string.replace(/(\r\n|\n|\r)/gm, '')); const __DEV__ = (process.env.NODE_ENV !== 'production'); import Style from '../src/index.js'; describe('Style-20', () => { it('Base64 images used in backgrounds should not have their semicolons altered', () => { const wrapper = TestUtils.renderIntoDocument( <div> <Style> {` .foo { background-image:url("data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="); } `} <div className="foo"> <div className="foo"></div> </div> </Style> </div> ); const rootNode = findDOMNode(wrapper).children[0]; const styleNode = rootNode.children[0]; expect(/data\:image\/gif\;base64\,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw\=\=/g.test(styleNode.textContent)).toBeTruthy(); }); });