Skip to content

Commit

Permalink
chore(tests): Adds attribute passthrough test helper
Browse files Browse the repository at this point in the history
function propagateAttributes can be used in testing that simple
componenets passthrough className, id, style, or other attrs

[#87784030]
  • Loading branch information
Caroline Taymor and Kenny Wang authored and pivotal ui committed Jul 15, 2015
1 parent 4f2a0e1 commit a164d9d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions spec/pivotal-ui-react/spec_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('<main id="root"/>');
Expand Down

0 comments on commit a164d9d

Please sign in to comment.