From a164d9dd9f0b1e17bd27f6f682f06c5ff8bebd37 Mon Sep 17 00:00:00 2001 From: Caroline Taymor and Kenny Wang Date: Wed, 15 Jul 2015 13:52:06 -0700 Subject: [PATCH] chore(tests): Adds attribute passthrough test helper function propagateAttributes can be used in testing that simple componenets passthrough className, id, style, or other attrs [#87784030] --- spec/pivotal-ui-react/spec_helper.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec/pivotal-ui-react/spec_helper.js b/spec/pivotal-ui-react/spec_helper.js index f06f96b45..0e91f4cd8 100644 --- a/spec/pivotal-ui-react/spec_helper.js +++ b/spec/pivotal-ui-react/spec_helper.js @@ -36,6 +36,20 @@ class TransitionGroupMock extends global.React.Component { }; } +export function propagateAttributes(componentIdentifier, attributeHash) { + describe('when className, id and style are given', () => { + it('adds className to the correct component', () => { + expect(componentIdentifier).toHaveClass(attributeHash.className); + }); + it('adds id to the correct component', () => { + expect(componentIdentifier).toHaveAttr('id', attributeHash.id); + }); + it('adds style to the correct component', () => { + expect(componentIdentifier).toHaveCss(attributeHash.style); + }); + }); +} + beforeEach(function() { jasmine.clock().install(); $('body').find('#root').remove().end().append('
');