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

Commit 76dc904

Browse files
author
Dom Harrington
committed
Add glossaryitem tests and update snapshots
1 parent e4ecf84 commit 76dc904

File tree

4 files changed

+31
-49
lines changed

4 files changed

+31
-49
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const React = require('react');
2+
const { shallow } = require('enzyme');
3+
4+
const GlossaryItem = require('../src/GlossaryItem');
5+
6+
test('should output a glossary item if the term exists', () => {
7+
const term = 'acme';
8+
const definition = 'This is a definition';
9+
const glossaryItem = shallow(
10+
<GlossaryItem
11+
term={term}
12+
terms={[{ term, definition }]}
13+
/>,
14+
);
15+
16+
expect(glossaryItem.find('.glossary-item.highlight').text()).toBe(term);
17+
expect(glossaryItem.find('.tooltip-content-body').text()).toBe(`- ${term} - ${definition}`);
18+
});
19+
20+
test('should output nothing if the term does not exist', () => {
21+
expect(shallow(
22+
<GlossaryItem
23+
term="something"
24+
terms={[]}
25+
/>,
26+
).html()).toBe(null);
27+
});

packages/api-explorer/__tests__/block-types/TextArea.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ describe('TextArea', () => {
99
text: 'this is text',
1010
};
1111
const textArea = shallow(<TextArea block={block} />);
12-
expect(textArea.text()).toBe(block.text);
12+
expect(textArea.find('p').text()).toBe(block.text);
1313
});
1414
});
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

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

55
exports[`should render markdown in body 1`] = `
6-
"<div><h1 class=\\"header-scroll\\"><div class=\\"anchor waypoint\\" id=\\"section-heading\\"></div>heading<a class=\\"fa fa-anchor\\" href=\\"#section-heading\\"></a></h1>
7-
<p><code><span class=\\"cm-s-neo\\">test</span></code></p></div>"
6+
"<h1 class=\\"header-scroll\\"><div class=\\"anchor waypoint\\" id=\\"section-heading\\"></div>heading<a class=\\"fa fa-anchor\\" href=\\"#section-heading\\"></a></h1>
7+
<p><code><span class=\\"cm-s-neo\\">test</span></code></p>"
88
`;

packages/api-explorer/__tests__/lib/markdown/renderer.test.js

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)