Skip to content

Commit

Permalink
update dimension when props being received
Browse files Browse the repository at this point in the history
  • Loading branch information
hankhsiao committed Mar 30, 2016
1 parent 413f9a0 commit 435f662
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Sticky.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ class Sticky extends Component {
}

componentWillReceiveProps () {
this.forceUpdate();
this.updateInitialDimension();
this.update();
}

componentWillUnmount () {
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/Sticky-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ describe('Sticky', function () {
window.scrollTo(0, 0);
shouldBeReset(inner);
expect(outer.className).to.not.contain('active');

// Increase coverage
sticky.componentWillReceiveProps();
});

it('should work as expected (long Sticky)', function () {
Expand Down

0 comments on commit 435f662

Please sign in to comment.