-
Notifications
You must be signed in to change notification settings - Fork 232
fix(top-app-bar): foundation should be destroyed and reinitialized on variant change #519
fix(top-app-bar): foundation should be destroyed and reinitialized on variant change #519
Conversation
…nitialized on variant changes
…nitialized on variant changes (adding missing screenshot test)
Codecov Report
@@ Coverage Diff @@
## rc0.8.0 #519 +/- ##
===========================================
+ Coverage 96.63% 96.64% +0.01%
===========================================
Files 59 59
Lines 1991 1999 +8
Branches 239 241 +2
===========================================
+ Hits 1924 1932 +8
Misses 67 67
Continue to review full report at Codecov.
|
please water branch with rc0.8.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't done a full review, but one comment so far.
I'm afraid I am not quite sure what you mean by water. Yesterday during my work on the PR I fell behind one commit. I merged that in this afternoon: 0af79bd |
@@ -204,6 +204,111 @@ test('#enableRippleOnElement throws error if a native element', () => { | |||
); | |||
}); | |||
|
|||
test('when changes from short to fixed the foundation changes', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow great test coverage!
assert.exists(wrapper.instance().foundation_); | ||
}); | ||
|
||
test('when changes from short to shortCollpased the foundation changes', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the foundation not change in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I understand it should reinitialize. When init()
is called on MDCShortTopAppBarFoundation
it registers a resize handler if initialized as a short variant. If it begins life collapsed it would not be necessary to register the resize handler. [0] Alternatively the resize handler could simply be deregistered. But I think this would work just as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah right - this is because you would want the short collapsed to immediately collapse. Good call. Thanks!
Rereviewed your changes! Watering a branch is making it up to date with rc0.8.0 (the base branch) |
@@ -69,10 +69,25 @@ export default class TopAppBar extends React.Component { | |||
this.foundation_.destroy(); | |||
} | |||
|
|||
componentDidUpdate(prevProps) { | |||
const foundationChanged = ['short', 'shortCollapsed', 'fixed'] | |||
.some((variant) => this.props[variant] !== prevProps[variant] ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting issue, but for the sake of time I'm going to ignore this one and fix in a following pr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good!
@mgr34 please update your golden json file like in this commit |
Also looks like the CLA isn't signed. Could you please sign the PR please. |
Ya looks like its back to being green! Thanks :) I will merge it |
@mgr34 please resolve conflicts |
updated tests #539 |
Tests passing in #539 and CLA signed #519 (comment) |
this should close issue #517. hope I didn't go overboard on the unit tests. As noted in discord I am having trouble getting screenshot tests to run. I have added a new one.
I signed it