Skip to content

Commit

Permalink
Merge 74e060b into 87df4c8
Browse files Browse the repository at this point in the history
  • Loading branch information
jbadan committed Jan 16, 2019
2 parents 87df4c8 + 74e060b commit ef41a4b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
10 changes: 9 additions & 1 deletion 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 @@ -36,14 +38,18 @@ export class Alert extends Component {
{...props}>
{dismissable && (
<button
{...buttonProps}
aria-controls='j2ALl423'
aria-label='Close'
className='fd-alert__close'
onClick={() => this.closeAlertHandler()} />
)}
{children}
{link && (
<a className='fd-link' href={link}>
<a
{...linkProps}
className='fd-link'
href={link}>
{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 ef41a4b

Please sign in to comment.