Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Add glossaryitem tests and update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Dom Harrington committed Jun 28, 2018
1 parent e4ecf84 commit 76dc904
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 49 deletions.
27 changes: 27 additions & 0 deletions packages/api-explorer/__tests__/GlossaryItem.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const React = require('react');
const { shallow } = require('enzyme');

const GlossaryItem = require('../src/GlossaryItem');

test('should output a glossary item if the term exists', () => {
const term = 'acme';
const definition = 'This is a definition';
const glossaryItem = shallow(
<GlossaryItem
term={term}
terms={[{ term, definition }]}
/>,
);

expect(glossaryItem.find('.glossary-item.highlight').text()).toBe(term);
expect(glossaryItem.find('.tooltip-content-body').text()).toBe(`- ${term} - ${definition}`);
});

test('should output nothing if the term does not exist', () => {
expect(shallow(
<GlossaryItem
term="something"
terms={[]}
/>,
).html()).toBe(null);
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ describe('TextArea', () => {
text: 'this is text',
};
const textArea = shallow(<TextArea block={block} />);
expect(textArea.text()).toBe(block.text);
expect(textArea.find('p').text()).toBe(block.text);
});
});
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`should render body 1`] = `"<div><p>body</p></div>"`;
exports[`should render body 1`] = `"<p>body</p>"`;

exports[`should render markdown in body 1`] = `
"<div><h1 class=\\"header-scroll\\"><div class=\\"anchor waypoint\\" id=\\"section-heading\\"></div>heading<a class=\\"fa fa-anchor\\" href=\\"#section-heading\\"></a></h1>
<p><code><span class=\\"cm-s-neo\\">test</span></code></p></div>"
"<h1 class=\\"header-scroll\\"><div class=\\"anchor waypoint\\" id=\\"section-heading\\"></div>heading<a class=\\"fa fa-anchor\\" href=\\"#section-heading\\"></a></h1>
<p><code><span class=\\"cm-s-neo\\">test</span></code></p>"
`;
45 changes: 0 additions & 45 deletions packages/api-explorer/__tests__/lib/markdown/renderer.test.js

This file was deleted.

0 comments on commit 76dc904

Please sign in to comment.