Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('styled applies styles object', t => {
const styletron = new StyletronServer();
const StyledComponent = styled('div', {color: 'red'});
const result = InfernoTestUtils.renderIntoDocument(
createElement(Provider, {styletron}, createElement(StyledComponent))
);
const element = InfernoTestUtils.findRenderedDOMElementWithTag(result, 'div');
t.equal(element.className, 'a', 'matches expected className');
t.equal(styletron.getCss(), '.a{color:red}', 'matches expected CSS');
t.end();
});
test('styled passes through valid props', t => {
const styletron = new StyletronServer();
const StyledComponent = styled('div', {color: 'red'});
const result = InfernoTestUtils.renderIntoDocument(
createElement(
Provider,
{styletron},
createElement(StyledComponent, {
'data-bar': 'bar',
})
)
);
const element = InfernoTestUtils.findRenderedDOMElementWithTag(result, 'div');
t.equal(
element.getAttribute('data-bar'),
'bar',
'valid attribute prop passed through'
);
t.end();
});