Comparing version 1.1.0 to 1.2.0
@@ -6,2 +6,7 @@ # Changelog | ||
### 1.2.0 (2017-11-12) | ||
- Update React to v16 | ||
- Update brcast | ||
### 1.1.0 (2017-07-12) | ||
@@ -8,0 +13,0 @@ |
{ | ||
"name": "theming", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Unified CSSinJS theming solution for React", | ||
@@ -45,2 +45,3 @@ "main": "dist/cjs", | ||
"all": true, | ||
"cache": true, | ||
"reporter": [ | ||
@@ -71,5 +72,5 @@ "lcov", | ||
"devDependencies": { | ||
"ava": "^0.20.0", | ||
"ava": "^0.22.0", | ||
"babel-cli": "^6.24.1", | ||
"babel-eslint": "^7.2.3", | ||
"babel-eslint": "^8.0.1", | ||
"babel-preset-env": "^1.4.0", | ||
@@ -80,6 +81,7 @@ "babel-preset-es2017": "^6.24.1", | ||
"babel-register": "^6.24.1", | ||
"browser-env": "2.0.31", | ||
"coveralls": "^2.13.1", | ||
"browser-env": "^3.2.1", | ||
"coveralls": "3.0.0", | ||
"cross-env": "^5.0.1", | ||
"enzyme": "^2.8.2", | ||
"enzyme": "^3.1.0", | ||
"enzyme-adapter-react-16": "^1.0.2", | ||
"eslint": "^4.1.0", | ||
@@ -92,13 +94,16 @@ "eslint-config-pedant": "^0.10.0", | ||
"nyc": "^11.0.2", | ||
"react-dom": "^15.5.4", | ||
"react-test-renderer": "^15.5.4", | ||
"react": "^16.0.0", | ||
"react-dom": "^16.0.0", | ||
"react-test-renderer": "^16.0.0", | ||
"rimraf": "^2.6.1" | ||
}, | ||
"dependencies": { | ||
"brcast": "^2.0.0", | ||
"brcast": "^3.0.1", | ||
"is-function": "^1.0.1", | ||
"is-plain-object": "^2.0.1", | ||
"prop-types": "^15.5.8", | ||
"react": "^15.5.4" | ||
"prop-types": "^15.5.8" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=0.15" | ||
} | ||
} |
@@ -327,3 +327,3 @@ # theming | ||
const { channel, withTheme, ThemeProvider } = theming; | ||
const { channel, withTheme, ThemeProvider, themeListener } = theming; | ||
@@ -334,2 +334,3 @@ export default { | ||
ThemeProvider, | ||
themeListener, | ||
}; | ||
@@ -336,0 +337,0 @@ ``` |
@@ -5,3 +5,4 @@ import test from 'ava'; | ||
import createBroadcast from 'brcast'; | ||
import { mount } from 'enzyme'; | ||
import { mount, configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import isFunction from 'is-function'; | ||
@@ -13,2 +14,4 @@ import isPainObject from 'is-plain-object'; | ||
configure({ adapter: new Adapter() }); | ||
test(`createThemeListener's type`, t => { | ||
@@ -15,0 +18,0 @@ const actual = isFunction(createThemeListener); |
@@ -68,3 +68,3 @@ import React from 'react'; | ||
if (this.context[CHANNEL]) { | ||
this.unsubscribe = this.context[CHANNEL].subscribe(this.setOuterTheme); | ||
this.subscriptionId = this.context[CHANNEL].subscribe(this.setOuterTheme); | ||
} | ||
@@ -88,4 +88,5 @@ } | ||
componentWillUnmount() { | ||
if (typeof this.unsubscribe === 'function') { | ||
this.unsubscribe(); | ||
if (this.subscriptionId !== undefined) { | ||
this.context[CHANNEL].unsubscribe(this.subscriptionId); | ||
delete this.subscriptionId; | ||
} | ||
@@ -92,0 +93,0 @@ } |
import test from 'ava'; | ||
import React, { Component } from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { mount, configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
@@ -11,2 +12,4 @@ import isFunction from 'is-function'; | ||
configure({ adapter: new Adapter() }); | ||
import { | ||
@@ -54,3 +57,2 @@ getChannel, | ||
const broadcast = createBroadcast(theme); | ||
const unsubscribed = getInterceptor(false); | ||
@@ -62,8 +64,15 @@ const wrapper = mount( | ||
t.false(unsubscribed()); | ||
const { subscriptionId } = wrapper.instance(); | ||
t.true(wrapper.instance().subscriptionId !== undefined, 'brcast subscriptionId is undefined'); | ||
t.true(typeof wrapper.instance().subscriptionId === 'number', 'brcast subscriptionId expected to be number'); | ||
wrapper.instance().unsubscribe = () => unsubscribed(true); | ||
const subscription = getInterceptor(subscriptionId); | ||
const brcastInst = wrapper.context(channel); | ||
brcastInst.unsubscribe = (id) => subscription(id); | ||
wrapper.setContext({[channel]: brcastInst}); | ||
wrapper.unmount(); | ||
t.true(unsubscribed(), `ThemeProvider should unsubscribe on unmounting`); | ||
t.true(subscription() === subscriptionId, `ThemeProvider should unsubscribe on unmounting`); | ||
}); | ||
@@ -70,0 +79,0 @@ |
import test from 'ava'; | ||
import React, { Component } from 'react'; | ||
import { mount, shallow } from 'enzyme'; | ||
import { mount, shallow, configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
@@ -18,2 +19,4 @@ import isFunction from 'is-function'; | ||
configure({ adapter: new Adapter() }); | ||
test(`createWithTheme's type`, t => { | ||
@@ -20,0 +23,0 @@ const actual = isFunction(createWithTheme); |
import test from 'ava'; | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { mount, configure } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import isFunction from 'is-function'; | ||
@@ -10,2 +11,4 @@ import isPlainObject from 'is-plain-object'; | ||
configure({ adapter: new Adapter() }); | ||
test(`createTheming's type`, t => { | ||
@@ -12,0 +15,0 @@ const actual = isFunction(createTheming); |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
374
47100
24
13
1009
1
+ Addedbrcast@3.0.2(transitive)
+ Addedreact@19.0.0(transitive)
- Removedreact@^15.5.4
- Removedasap@2.0.6(transitive)
- Removedbrcast@2.0.2(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.40(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)
Updatedbrcast@^3.0.1