diff --git a/packages/api-explorer/__tests__/GlossaryItem.test.jsx b/packages/api-explorer/__tests__/GlossaryItem.test.jsx new file mode 100644 index 000000000..3d87e0f2c --- /dev/null +++ b/packages/api-explorer/__tests__/GlossaryItem.test.jsx @@ -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( + , + ); + + 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( + , + ).html()).toBe(null); +}); diff --git a/packages/api-explorer/__tests__/block-types/TextArea.test.jsx b/packages/api-explorer/__tests__/block-types/TextArea.test.jsx index 1f2d4962f..68cdb636d 100644 --- a/packages/api-explorer/__tests__/block-types/TextArea.test.jsx +++ b/packages/api-explorer/__tests__/block-types/TextArea.test.jsx @@ -9,6 +9,6 @@ describe('TextArea', () => { text: 'this is text', }; const textArea = shallow(