Example #1
0
it('calls notify on error', () => {
  renderer
    .create(<ErrorBoundary><BadComponent /></ErrorBoundary>)
    .toJSON()
  expect(bugsnag.notify).toHaveBeenCalledTimes(1)
})
test('should handle blockquotes', () => {
  const input = '> Moo\n> Tools\n> FTW\n'
  const component = renderer.create(<Markdown source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
test('can render the most basic of documents (single paragraph)', () => {
  const component = renderer.create(<Markdown>Test</Markdown>)
  expect(component.toJSON()).toMatchSnapshot()
})
test('should handle images with special characters in alternative text', () => {
  const input = "This is ![a ninja's image](/ninja.png)."
  const component = renderer.create(<Markdown source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
test('should handle code tags with language specification', () => {
  const input = "```js\nvar foo = require('bar');\nfoo();\n```"
  const component = renderer.create(<Markdown source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
Example #6
0
 it('should match snapshot', () => {
   const tree = create(
     <ConversationTeaser {...Message.conversations[0]} select={mockFn} />
   ).toJSON()
   expect(tree).toMatchSnapshot()
 })
test('should handle images with custom uri transformer', () => {
  const input = 'This is ![an image](/ninja.png).'
  const transform = uri => uri.replace(/\.png$/, '.jpg')
  const component = renderer.create(<Markdown transformImageUri={transform} source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
test('Styles matches FormControlPlainText small', () => {
  const tree = renderer.create(<FormControlPlainText sm />).toJSON();
  expect(tree).toMatchSnapshot();
  expect(tree).toHaveStyleRule('padding-right', '0');
  expect(tree).toHaveStyleRule('padding-left', '0');
});
Example #9
0
 it('should match snapshot with null', () => {
   const tree = create(<AboutSection label="Firstname" value="" />).toJSON()
   expect(tree).toMatchSnapshot()
 })
Example #10
0
 it('should match snapshot for users search', () => {
   const tree = create(
     <SearchSection searchList={map(['first', 'second'])} listFor="member" />
   ).toJSON()
   expect(tree).toMatchSnapshot()
 })
it('should render <GiftedAvatar /> and compare with snapshot', () => {
  const tree = renderer.create(<GiftedAvatar />).toJSON();

  expect(tree).toMatchSnapshot();
});
test('price level renders price and size', () => {
  const rendered = renderer.create(
    <PriceLevel price='2.01' size='1' />
  );
  expect(rendered.toJSON()).toMatchSnapshot();
});
Example #13
0
test('renders correctly', () => {
  const rendered = renderer.create(<TestComponent />).toJSON();
  expect(rendered).toBeTruthy();
});
Example #14
0
it('should render correctly', () => {
  const component = renderer.create(<H4>Text</H4>)
  const tree = component.toJSON()
  expect(tree).toMatchSnapshot()
})
test('Styles matches Nav', () => {
  const tree = renderer.create(<Nav />).toJSON();
  expect(tree).toMatchSnapshot();
  expect(tree).toHaveStyleRule('display', 'block');
});
Example #16
0
 it('should match snapshot', () => {
   const tree = create(
     <AboutSection label="Username" value="takkar" />
   ).toJSON()
   expect(tree).toMatchSnapshot()
 })
Example #17
0
 it('should match snapshot', () => {
   const tree = create(<GroupTopOptions />).toJSON()
   expect(tree).toMatchSnapshot()
 })
Example #18
0
 it('should match snapshot with delete icon', () => {
   const tree = create(<MaterialIcon icon="delete" />).toJSON()
   expect(tree).toMatchSnapshot()
 })
it('renders correctly', () => {
  expect(renderer.create(<Article />).toJSON()).toMatchSnapshot();
});
 it('renders correctly', () => {
   const tree = renderer.create(<PageTemplate {...props} />).toJSON();
   expect(tree).toMatchSnapshot();
 });
test('should handle image references with custom uri transformer', () => {
  const input = 'This is ![The Waffle Ninja][ninja].\n\n[ninja]: https://some.host/img.png'
  const transform = uri => uri.replace(/\.png$/, '.jpg')
  const component = renderer.create(<Markdown transformImageUri={transform} source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
const parallelReferences = {
  prop1: parallelReferencesInner,
  prop2: parallelReferencesInner,
};
test('parallel references', parallelReferences);
test('able to customize indent', {prop: 'value'});
const bigObj = {};
for (let i = 0; i < 50; i++) {
  bigObj[i] = i;
}
test('big object', bigObj);

const element = React.createElement(
  'div',
  {onClick: () => {}, prop: {a: 1, b: 2}},
  React.createElement('div', {prop: {a: 1, b: 2}}),
  React.createElement('div'),
  React.createElement(
    'div',
    {prop: {a: 1, b: 2}},
    React.createElement('div', null, React.createElement('div')),
  ),
);

test('react', ReactTestRenderer.create(element).toJSON(), false, {
  plugins: [ReactTestComponent],
});

TIMES_TO_RUN = 100;
test('massive', worldGeoJson, true);
test('should be able to render inline code', () => {
  const input = 'Just call `renderToStaticMarkup()`, already'
  const component = renderer.create(<Markdown source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
 expect(() => renderer.create(<Wrapped />)).toThrow();
test('should only use first language definition on code blocks', () => {
  const input = "```js foo bar\nvar foo = require('bar');\nfoo();\n```"
  const component = renderer.create(<Markdown source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
test('renders correctly', () => {
  const tree = renderer.create(
    <BasicExample />
  ).toJSON();
  expect(tree).toMatchSnapshot();
});
test('should handle tight, unordered lists', () => {
  const input = '* Unordered\n* Lists\n* Are cool\n'
  const component = renderer.create(<Markdown source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
Example #28
0
 it('should match snapshot', () => {
   const tree = create(<Loading />).toJSON()
   expect(tree).toMatchSnapshot()
 })
test('should handle loose, unordered lists', () => {
  const input = '- foo\n\n- bar'
  const component = renderer.create(<Markdown source={input} />)
  expect(component.toJSON()).toMatchSnapshot()
})
Example #30
0
it('renders correctly on error', () => {
  const tree = renderer
    .create(<ErrorBoundary><BadComponent /></ErrorBoundary>)
    .toJSON()
  expect(tree).toBe(null)
})