From 2a8189fa23f4876bb3d6126780f9889339d882e3 Mon Sep 17 00:00:00 2001 From: CJ Cenizal Date: Mon, 4 Dec 2017 17:34:19 -0800 Subject: [PATCH] Add test coverage for EuiBadge. --- .../badge/__snapshots__/badge.test.js.snap | 184 +++++++++++++++++- src/components/badge/badge.test.js | 51 ++++- 2 files changed, 232 insertions(+), 3 deletions(-) diff --git a/src/components/badge/__snapshots__/badge.test.js.snap b/src/components/badge/__snapshots__/badge.test.js.snap index 8c2a6a3d391..6e0220bb4b2 100644 --- a/src/components/badge/__snapshots__/badge.test.js.snap +++ b/src/components/badge/__snapshots__/badge.test.js.snap @@ -9,7 +9,189 @@ exports[`EuiBadge is rendered 1`] = ` - + + Content + + + +`; + +exports[`EuiBadge props color accent is rendered 1`] = ` +
+ + + Content + + +
+`; + +exports[`EuiBadge props color danger is rendered 1`] = ` +
+ + + Content + + +
+`; + +exports[`EuiBadge props color default is rendered 1`] = ` +
+ + + Content + + +
+`; + +exports[`EuiBadge props color primary is rendered 1`] = ` +
+ + + Content + + +
+`; + +exports[`EuiBadge props color secondary is rendered 1`] = ` +
+ + + Content + + +
+`; + +exports[`EuiBadge props color warning is rendered 1`] = ` +
+ + + Content + + +
+`; + +exports[`EuiBadge props iconSide left is rendered 1`] = ` +
+ + + + + + + + + Content + + +
+`; + +exports[`EuiBadge props iconSide right is rendered 1`] = ` +
+ + + + + + + + + Content + + +
+`; + +exports[`EuiBadge props iconType is rendered 1`] = ` +
+ + + + + + + + + Content +
`; diff --git a/src/components/badge/badge.test.js b/src/components/badge/badge.test.js index 480eba6bebe..2860c46c881 100644 --- a/src/components/badge/badge.test.js +++ b/src/components/badge/badge.test.js @@ -2,15 +2,62 @@ import React from 'react'; import { render } from 'enzyme'; import { requiredProps } from '../../test/required_props'; -import { EuiBadge } from './badge'; +import { EuiBadge, COLORS, ICON_SIDES } from './badge'; describe('EuiBadge', () => { test('is rendered', () => { const component = render( - + + Content + ); expect(component) .toMatchSnapshot(); }); + + describe('props', () => { + describe('iconType', () => { + it('is rendered', () => { + const component = render( + + Content + + ); + + expect(component) + .toMatchSnapshot(); + }); + }); + + describe('color', () => { + COLORS.forEach(color => { + it(`${color} is rendered`, () => { + const component = render( + + Content + + ); + + expect(component) + .toMatchSnapshot(); + }); + }); + }); + + describe('iconSide', () => { + ICON_SIDES.forEach(iconSide => { + it(`${iconSide} is rendered`, () => { + const component = render( + + Content + + ); + + expect(component) + .toMatchSnapshot(); + }); + }); + }); + }); });