From 4759e325ba44ceeb5c094bfdfdd800ddc6253596 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 | 126 ++++++++++++++++++ src/components/badge/badge.test.js | 41 +++++- 2 files changed, 166 insertions(+), 1 deletion(-) diff --git a/src/components/badge/__snapshots__/badge.test.js.snap b/src/components/badge/__snapshots__/badge.test.js.snap index 8c2a6a3d391f..e7b2a4958b97 100644 --- a/src/components/badge/__snapshots__/badge.test.js.snap +++ b/src/components/badge/__snapshots__/badge.test.js.snap @@ -13,3 +13,129 @@ exports[`EuiBadge is rendered 1`] = ` `; + +exports[`EuiBadge props color accent is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props color danger is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props color default is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props color primary is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props color secondary is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props color warning is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props iconSide left is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props iconSide right is rendered 1`] = ` +
+ + + +
+`; + +exports[`EuiBadge props iconType is rendered 1`] = ` +
+ + + + + + + + + +
+`; diff --git a/src/components/badge/badge.test.js b/src/components/badge/badge.test.js index 480eba6bebe8..7e0f1206133b 100644 --- a/src/components/badge/badge.test.js +++ b/src/components/badge/badge.test.js @@ -2,7 +2,7 @@ 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', () => { @@ -13,4 +13,43 @@ describe('EuiBadge', () => { expect(component) .toMatchSnapshot(); }); + + describe('props', () => { + describe('iconType', () => { + it('is rendered', () => { + const component = render( + + ); + + expect(component) + .toMatchSnapshot(); + }); + }); + + describe('color', () => { + COLORS.forEach(color => { + it(`${color} is rendered`, () => { + const component = render( + + ); + + expect(component) + .toMatchSnapshot(); + }); + }); + }); + + describe('iconSide', () => { + ICON_SIDES.forEach(iconSide => { + it(`${iconSide} is rendered`, () => { + const component = render( + + ); + + expect(component) + .toMatchSnapshot(); + }); + }); + }); + }); });