How to use the inferno-test-utils.findRenderedDOMElementWithTag function in inferno-test-utils

To help you get started, we’ve selected a few inferno-test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github styletron / styletron / packages / styletron-inferno / src / __tests__ / browser.js View on Github external
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();
});
github styletron / styletron / packages / styletron-inferno / src / __tests__ / browser.js View on Github external
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();
});