Skip to content

Instantly share code, notes, and snippets.

@nackjicholson
Created January 14, 2016 19:07
Show Gist options
  • Select an option

  • Save nackjicholson/d106d699ea7d2ee832ac to your computer and use it in GitHub Desktop.

Select an option

Save nackjicholson/d106d699ea7d2ee832ac to your computer and use it in GitHub Desktop.
// ...
function createComponent(customProps = {}) {
const props = Object.assign({ baseId: 'test-baseId' }, customProps);
const StatelessRadio = statelessRadio(React);
return <StatelessRadio {...props} />;
}
describe('statelessRadio', () => {
// ...
it('should render a wrapper div with id equal to baseId prop', () => {
const component = createComponent();
// ...
});
it('should render a p tag with the text from the titleText prop', () => {
const props = { titleText: 'test.title' };
const component = createComponent(props);
// ...
});
it('should render radio inputs and their labels from the inputs prop', () => {
const props = {
inputs: [
{ value: 'alpha.value', label: 'alpha.label' },
{ value: 'bravo.value', label: 'bravo.label' },
{ value: 'charlie.value', label: 'charlie.label' }
]
};
const component = createComponent(props);
const $component = $(component).render();
// ...
});
// ...
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment