Skip to content

Commit

Permalink
Merge branch 'release/0.2.16'
Browse files Browse the repository at this point in the history
  • Loading branch information
igorprado committed Oct 19, 2017
2 parents 012e088 + 893713c commit d37db94
Show file tree
Hide file tree
Showing 9 changed files with 5,943 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "0.12"
- "6"
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.2.16 - Oct 19, 2017

* Support for React 16 (thanks to @marudor)

## 0.2.15 - Aug 1, 2017

* UMD build now specifies the library name (thanks to @franckamayou)
Expand Down
2 changes: 1 addition & 1 deletion example/build/app.css

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions example/build/app.js

Large diffs are not rendered by default.

41 changes: 20 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-notification-system",
"version": "0.2.15",
"version": "0.2.16",
"description": "A React Notification System fully customized",
"main": "dist/NotificationSystem.js",
"scripts": {
Expand Down Expand Up @@ -37,8 +37,8 @@
"prop-types": "^15.5.6"
},
"peerDependencies": {
"react": "0.14.x || ^15.0.0",
"react-dom": "0.14.x || ^15.0.0"
"react": "0.14.x || ^15.0.0 || ^16.0.0",
"react-dom": "0.14.x || ^15.0.0 || ^16.0.0"
},
"devDependencies": {
"autoprefixer-loader": "^3.1.0",
Expand All @@ -49,32 +49,31 @@
"babel-plugin-react-transform": "^2.0.2",
"babel-preset-airbnb": "^2.0.0",
"css-loader": "^0.24.0",
"eslint": "3.4.0",
"eslint-config-airbnb": "^10.0.1",
"eslint-plugin-import": "^1.14.0",
"eslint-plugin-jsx-a11y": "^2.2.1",
"eslint-plugin-react": "^6.2.0",
"expect": "^1.12.1",
"eslint": "4.9.0",
"eslint-config-airbnb": "^16.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"expect": "^21.2.1",
"express": "^4.13.3",
"extract-text-webpack-plugin": "^0.8.2",
"file-loader": "^0.8.4",
"install": "^0.1.8",
"install": "^0.10.1",
"isparta-loader": "^1.0.0",
"karma": "^0.13.10",
"karma-chai-plugins": "^0.6.0",
"karma-chrome-launcher": "^0.2.1",
"karma-cli": "^0.1.1",
"karma-coverage": "^0.5.2",
"karma": "^1.7.1",
"karma-chai-plugins": "^0.9.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "^1.0.1",
"karma-coverage": "^1.1.1",
"karma-coveralls": "^1.1.2",
"karma-firefox-launcher": "^0.1.6",
"karma-mocha": "^0.2.0",
"karma-firefox-launcher": "^1.0.1",
"karma-mocha": "^1.3.0",
"karma-sourcemap-loader": "^0.3.6",
"karma-webpack": "^1.7.0",
"mocha": "^2.3.3",
"mocha": "^4.0.1",
"node-sass": "^3.3.3",
"react": "^15.0.0",
"react-addons-test-utils": "^15.0.0",
"react-dom": "^15.0.0",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-tools": "^0.13.2",
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
Expand Down
4 changes: 2 additions & 2 deletions src/NotificationItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ var NotificationItem = createReactClass({
_onTransitionEnd: function() {
if (this._removeCount > 0) return;
if (this.state.removed) {
this._removeCount++;
this._removeCount += 1;
this._removeNotification();
}
},
Expand Down Expand Up @@ -306,7 +306,7 @@ var NotificationItem = createReactClass({
<button className="notification-action-button"
onClick={ this._defaultAction }
style={ this._styles.action }>
{ notification.action.label }
{ notification.action.label }
</button>
</div>
);
Expand Down
16 changes: 7 additions & 9 deletions src/NotificationSystem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ var NotificationSystem = createReactClass({
throw new Error('\'' + _notification.level + '\' is not a valid level.');
}

// eslint-disable-next-line
if (isNaN(_notification.autoDismiss)) {
throw new Error('\'autoDismiss\' must be a number.');
}
Expand All @@ -136,7 +137,7 @@ var NotificationSystem = createReactClass({
this.uid += 1;

// do not add if the notification already exists based on supplied uid
for (i = 0; i < notifications.length; i++) {
for (i = 0; i < notifications.length; i += 1) {
if (notifications[i].uid === _notification.uid) {
return false;
}
Expand Down Expand Up @@ -167,7 +168,6 @@ var NotificationSystem = createReactClass({
// NOTE: Stop iterating further and return the found notification.
// Since UIDs are uniques and there won't be another notification found.
foundNotification = self.refs[container].refs[_notification];
return;
}
});
}
Expand Down Expand Up @@ -201,13 +201,11 @@ var NotificationSystem = createReactClass({
return;
}

newNotifications.push(
merge(
{},
foundNotification,
newNotification
)
);
newNotifications.push(merge(
{},
foundNotification,
newNotification
));

this.setState({
notifications: newNotifications
Expand Down
20 changes: 10 additions & 10 deletions test/notification-system.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global sinon */

import React, { Component } from 'react';
import TestUtils from 'react-addons-test-utils';
import TestUtils from 'react-dom/test-utils';
import expect from 'expect';
import NotificationSystem from 'NotificationSystem';
import { positions, levels } from 'constants';
Expand Down Expand Up @@ -56,12 +56,12 @@ describe('Notification Component', function() {

it('should be rendered', done => {
component = TestUtils.findRenderedDOMComponentWithClass(instance, 'notifications-wrapper');
expect(component).toExist();
expect(component).not.toBeNull();
done();
});

it('should hold the component ref', done => {
expect(component).toExist();
expect(component).not.toBeNull();
done();
});

Expand All @@ -75,8 +75,8 @@ describe('Notification Component', function() {
it('should not set a notification visibility class when the notification is initially added', done => {
component.addNotification(defaultNotification);
let notification = TestUtils.findRenderedDOMComponentWithClass(instance, 'notification');
expect(notification.className).toNotMatch(/notification-hidden/);
expect(notification.className).toNotMatch(/notification-visible/);
expect(notification.className).not.toMatch(/notification-hidden/);
expect(notification.className).not.toMatch(/notification-visible/);
done();
});

Expand Down Expand Up @@ -109,7 +109,7 @@ describe('Notification Component', function() {
containers.forEach(function(container) {
for (let level of Object.keys(levels)) {
let notification = container.getElementsByClassName('notification-' + levels[level]);
expect(notification).toExist();
expect(notification).not.toBeNull();
}
});

Expand Down Expand Up @@ -249,7 +249,7 @@ describe('Notification Component', function() {
let notification = TestUtils.findRenderedDOMComponentWithClass(instance, 'notification');
TestUtils.Simulate.click(notification);
let notificationAfterClicked = TestUtils.findRenderedDOMComponentWithClass(instance, 'notification');
expect(notificationAfterClicked).toExist();
expect(notificationAfterClicked).not.toBeNull();
done();
});

Expand All @@ -261,7 +261,7 @@ describe('Notification Component', function() {

component.addNotification(defaultNotification);
let button = TestUtils.findRenderedDOMComponentWithClass(instance, 'notification-action-button');
expect(button).toExist();
expect(button).not.toBeNull();
done();
});

Expand Down Expand Up @@ -325,7 +325,7 @@ describe('Notification Component', function() {

component.addNotification(defaultNotification);
let customContainer = TestUtils.findRenderedDOMComponentWithClass(instance, 'custom-container');
expect(customContainer).toExist();
expect(customContainer).not.toBeNull();
done();
});

Expand All @@ -336,7 +336,7 @@ describe('Notification Component', function() {
TestUtils.Simulate.mouseEnter(notification);
clock.tick(4000);
let _notification = TestUtils.findRenderedDOMComponentWithClass(instance, 'notification');
expect(_notification).toExist();
expect(_notification).not.toBeNull();
done();
});

Expand Down
Loading

0 comments on commit d37db94

Please sign in to comment.