Skip to content

Commit 1c971c4

Browse files
authored
Merge pull request #155 from jamesphilipps/master
ISSUE-107 - Allowing className to be added to each notification to fa…
2 parents e9058c2 + c1824bb commit 1c971c4

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/NotificationItem.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ class NotificationItem extends React.Component {
243243
var title = null;
244244
var message = null;
245245

246+
if (this.props.notification.className) {
247+
className += ' ' + this.props.notification.className;
248+
}
249+
246250
if (this.state.visible) {
247251
className += ' notification-visible';
248252
} else if (this.state.visible === false) {

test/notification-system.test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ describe('Notification Component', function() {
8989
done();
9090
});
9191

92+
it('should add additional classes to the notification if specified', done => {
93+
component.addNotification(Object.assign({},defaultNotification, {className: 'FOO'}));
94+
let notification = TestUtils.findRenderedDOMComponentWithClass(instance, 'notification');
95+
expect(notification.className).to.contain(' FOO');
96+
done();
97+
});
98+
9299
it('should render notifications in all positions with all levels', done => {
93100
let count = 0;
94101
for (let position of Object.keys(positions)) {
@@ -392,7 +399,7 @@ describe('Notification Component', function() {
392399
done();
393400
});
394401

395-
it('should render containers with a overrided width', done => {
402+
it('should render containers with a overriden width', done => {
396403
notificationObj.position = 'tc';
397404
component.addNotification(notificationObj);
398405
let notification = TestUtils.findRenderedDOMComponentWithClass(instance, 'notifications-tc');
@@ -410,7 +417,7 @@ describe('Notification Component', function() {
410417
done();
411418
});
412419

413-
it('should render containers with a overrided width for a specific position', done => {
420+
it('should render containers with a overriden width for a specific position', done => {
414421
notificationObj.position = 'tl';
415422
component.addNotification(notificationObj);
416423
let notification = TestUtils.findRenderedDOMComponentWithClass(instance, 'notifications-tl');

0 commit comments

Comments
 (0)