From f3e5c35b49db114968b722652738c4cdaec705ee Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Thu, 11 May 2017 08:19:10 +0800 Subject: [web] Add tests for js/components/common/Button.jsx --- .../js/__tests__/components/common/ButtonSpec.js | 26 +++++++++++++++++++ .../common/__snapshots__/ButtonSpec.js.snap | 30 ++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 web/src/js/__tests__/components/common/ButtonSpec.js create mode 100644 web/src/js/__tests__/components/common/__snapshots__/ButtonSpec.js.snap (limited to 'web/src') diff --git a/web/src/js/__tests__/components/common/ButtonSpec.js b/web/src/js/__tests__/components/common/ButtonSpec.js new file mode 100644 index 00000000..ea05ee6e --- /dev/null +++ b/web/src/js/__tests__/components/common/ButtonSpec.js @@ -0,0 +1,26 @@ +import React from 'react' +import renderer from 'react-test-renderer' +import Button from '../../../components/common/Button' + +describe('Button Component', () => { + + it('should render correctly', () => { + let button = renderer.create( + + ), + tree = button.toJSON() + expect(tree).toMatchSnapshot() + }) + + it('should be able to be disabled', () => { + let button = renderer.create( + + ), + tree = button.toJSON() + expect(tree).toMatchSnapshot() + }) +}) diff --git a/web/src/js/__tests__/components/common/__snapshots__/ButtonSpec.js.snap b/web/src/js/__tests__/components/common/__snapshots__/ButtonSpec.js.snap new file mode 100644 index 00000000..1d403b2d --- /dev/null +++ b/web/src/js/__tests__/components/common/__snapshots__/ButtonSpec.js.snap @@ -0,0 +1,30 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Button Component should be able to be disabled 1`] = ` +
+ + foo + +
+`; + +exports[`Button Component should render correctly 1`] = ` +
+ + + foo + +
+`; -- cgit v1.2.3