diff --git a/src/components/Render/__snapshots__/test.js.snap b/src/components/Render/__snapshots__/test.js.snap new file mode 100644 index 0000000..c93ee1c --- /dev/null +++ b/src/components/Render/__snapshots__/test.js.snap @@ -0,0 +1,155 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Render debugging 1`] = ` +
+ + + Example + + + + + +
+`; + +exports[`Render types Box 1`] = ` +
+ + + + Example + + + +
+`; + +exports[`Render types HorizontalLayout 1`] = ` +
+ + + + Example + + + Another Example + + + +
+`; + +exports[`Render types Loop 1`] = ` +
+ + + + Example + + + +
+`; + +exports[`Render types Pin 1`] = ` +
+ + + +
+`; + +exports[`Render types Text 1`] = ` +
+ + + Example + + +
+`; + +exports[`Render types VerticalLayout 1`] = ` +
+ + + + Example + + + Another Example + + + +
+`; diff --git a/src/components/Render/test.js b/src/components/Render/test.js new file mode 100644 index 0000000..fa17195 --- /dev/null +++ b/src/components/Render/test.js @@ -0,0 +1,115 @@ +import React from 'react'; +import { shallow } from 'enzyme'; + +import Render from 'components/Render'; + +const testType = (name, item) => { + test(name, () => { + const data = { type: 'SVG', children: [item] }; + const component = shallow( + + ); + expect(component).toMatchSnapshot(); + }); +}; + +describe('Render', () => { + test('debugging', () => { + const data = { + type: 'SVG', + children: [ + { + type: 'Text', + debug: true, + box: { + width: 100, + height: 50, + axisY: 10, + axisX1: 5, + axisX2: 95 + }, + children: [ + 'Example' + ] + } + ] + }; + const component = shallow( + + ); + expect(component).toMatchSnapshot(); + }); + + describe('types', () => { + testType('Pin', { + type: 'Pin' + }); + + testType('Text', { + type: 'Text', + children: [ + 'Example' + ] + }); + + testType('Box', { + type: 'Box', + children: [ + { + type: 'Text', + children: [ + 'Example' + ] + } + ] + }); + + testType('Loop', { + type: 'Loop', + children: [ + { + type: 'Text', + children: [ + 'Example' + ] + } + ] + }); + + testType('HorizontalLayout', { + type: 'HorizontalLayout', + children: [ + { + type: 'Text', + children: [ + 'Example' + ] + }, + { + type: 'Text', + children: [ + 'Another Example' + ] + } + ] + }); + + testType('VerticalLayout', { + type: 'VerticalLayout', + children: [ + { + type: 'Text', + children: [ + 'Example' + ] + }, + { + type: 'Text', + children: [ + 'Another Example' + ] + } + ] + }); + }); +});