Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Support React 16.9 #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions __test__/BlockUi.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ describe('BlockUi', function() {
const instance = wrapper.instance();
instance.helper = { parentNode: { contains: sinon.stub().returns(true) } };
wrapper.find('input').simulate('click');
instance.componentWillReceiveProps({ blocking: true });
instance.UNSAFE_componentWillReceiveProps({ blocking: true });
expect(instance.focused).to.equal(document.activeElement);
expect(instance.helper.parentNode.contains).to.have.been.called;
});
Expand All @@ -419,7 +419,7 @@ describe('BlockUi', function() {
const wrapper = shallow(<BlockUi keepInView><input /></BlockUi>);
const instance = wrapper.instance();
sinon.spy(window, 'addEventListener');
instance.componentWillReceiveProps({ blocking: true, keepInView: true });
instance.UNSAFE_componentWillReceiveProps({ blocking: true, keepInView: true });
expect(window.addEventListener).to.have.been.calledWith('scroll', instance.handleScroll);
window.addEventListener.restore();
});
Expand All @@ -431,7 +431,7 @@ describe('BlockUi', function() {
const wrapper = shallow(<BlockUi blocking><input /></BlockUi>);
const instance = wrapper.instance();
sinon.spy(window, 'addEventListener');
instance.componentWillReceiveProps({ blocking: true, keepInView: true });
instance.UNSAFE_componentWillReceiveProps({ blocking: true, keepInView: true });
expect(window.addEventListener).to.have.been.calledWith('scroll', instance.handleScroll);
window.addEventListener.restore();
});
Expand All @@ -444,7 +444,7 @@ describe('BlockUi', function() {
const instance = wrapper.instance();
const spy = sinon.spy();
instance.focused = { focus: spy };
instance.componentWillReceiveProps({ blocking: false });
instance.UNSAFE_componentWillReceiveProps({ blocking: false });
expect(spy).to.have.been.called;
});
});
Expand All @@ -453,15 +453,15 @@ describe('BlockUi', function() {
const wrapper = shallow(<BlockUi blocking><input /></BlockUi>);
const instance = wrapper.instance();
instance.focused = null;
expect(instance.componentWillReceiveProps.bind(instance, { blocking: false })).to.not.throw;
expect(instance.UNSAFE_componentWillReceiveProps.bind(instance, { blocking: false })).to.not.throw;
});
});
describe('keepInView', () => {
it('should remove a scroll listener', () => {
const wrapper = shallow(<BlockUi blocking><input /></BlockUi>);
const instance = wrapper.instance();
sinon.spy(window, 'removeEventListener');
instance.componentWillReceiveProps({ blocking: false });
instance.UNSAFE_componentWillReceiveProps({ blocking: false });
expect(window.removeEventListener).to.have.been.calledWith('scroll', instance.handleScroll);
window.removeEventListener.restore();
});
Expand Down
2 changes: 1 addition & 1 deletion src/BlockUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class BlockUi extends Component {
}


componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
if (nextProps.blocking !== this.props.blocking) {
if (nextProps.blocking) {
// blocking started
Expand Down
2 changes: 1 addition & 1 deletion src/ReduxBlockUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ReduxBlockUi extends Component {
};
}

componentWillMount() {
UNSAFE_componentWillMount() {
register(this.middleware);
}

Expand Down