Skip to content

Commit

Permalink
Merge ceb47c4 into 00d5fd7
Browse files Browse the repository at this point in the history
  • Loading branch information
jbadan committed Jan 16, 2019
2 parents 00d5fd7 + ceb47c4 commit e424f4a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
12 changes: 10 additions & 2 deletions src/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ export class Alert extends Component {

render() {
const {
buttonProps,
type,
link,
linkProps,
linkText,
dismissable,
children,
Expand All @@ -39,11 +41,15 @@ export class Alert extends Component {
aria-controls='j2ALl423'
aria-label='Close'
className='fd-alert__close'
onClick={() => this.closeAlertHandler()} />
onClick={() => this.closeAlertHandler()}
{...buttonProps} />
)}
{children}
{link && (
<a className='fd-link' href={link}>
<a
className='fd-link'
href={link}
{...linkProps}>
{linkText}{' '}
<span className='sap-icon--arrow-right sap-icon--s' />
</a>
Expand All @@ -56,9 +62,11 @@ export class Alert extends Component {
}

Alert.propTypes = {
buttonProps: PropTypes.object,
className: PropTypes.string,
dismissable: PropTypes.bool,
link: PropTypes.string,
linkProps: PropTypes.object,
linkText: PropTypes.string,
type: PropTypes.oneOf(['', 'warning', 'error', 'success', 'information'])
};
16 changes: 12 additions & 4 deletions src/Alert/Alert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,20 @@ describe('<Alert />', () => {
).toBe('Sample');
});

xtest('should allow props to be spread to the Alert component\'s button element when dismissable', () => {
// TODO: placeholder for this test description once that functionality is built
test('should allow props to be spread to the Alert component\'s button element when dismissable', () => {
const element = mount(<Alert buttonProps={{'data-sample': 'Sample'}} dismissable />);

expect(
element.find('button').getDOMNode().attributes['data-sample'].value
).toBe('Sample');
});

xtest('should allow props to be spread to the Alert component\'s a element when link provided', () => {
// TODO: placeholder for this test description once that functionality is built
test('should allow props to be spread to the Alert component\'s a element when link provided', () => {
const element = mount(<Alert link='javascript:void(0)' linkProps={{'data-sample': 'Sample'}} />);

expect(
element.find('a').getDOMNode().attributes['data-sample'].value
).toBe('Sample');
});
});
});

0 comments on commit e424f4a

Please sign in to comment.