Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header height not updated when Lock dialog is closed and reopened #1874

Merged
merged 2 commits into from
May 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
18 changes: 9 additions & 9 deletions src/__tests__/ui/box/__snapshots__/chrome.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ exports[`Chrome can dislay all global messages together 1`] = `
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 0,
"marginTop": 200,
}
}
>
Expand Down Expand Up @@ -182,7 +182,7 @@ exports[`Chrome correctly sets the header size when the "signin ready" event is
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 0,
"marginTop": 200,
}
}
>
Expand Down Expand Up @@ -298,7 +298,7 @@ exports[`Chrome correctly sets the header size when the "signin ready" event is
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 200,
"marginTop": 250,
}
}
>
Expand Down Expand Up @@ -414,7 +414,7 @@ exports[`Chrome correctly sets the header size when the "signup ready" event is
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 0,
"marginTop": 200,
}
}
>
Expand Down Expand Up @@ -530,7 +530,7 @@ exports[`Chrome correctly sets the header size when the "signup ready" event is
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 200,
"marginTop": 250,
}
}
>
Expand Down Expand Up @@ -646,7 +646,7 @@ exports[`Chrome renders correctly when there is a global information message 1`]
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 0,
"marginTop": 200,
}
}
>
Expand Down Expand Up @@ -777,7 +777,7 @@ exports[`Chrome renders correctly when there is a global message 1`] = `
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 0,
"marginTop": 200,
}
}
>
Expand Down Expand Up @@ -908,7 +908,7 @@ exports[`Chrome renders correctly when there is a global success message 1`] = `
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 0,
"marginTop": 200,
}
}
>
Expand Down Expand Up @@ -1039,7 +1039,7 @@ exports[`Chrome renders correctly with basic props 1`] = `
className="auth0-lock-content-body-wrapper"
style={
Object {
"marginTop": 0,
"marginTop": 200,
}
}
>
Expand Down
10 changes: 6 additions & 4 deletions src/__tests__/ui/box/chrome.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,25 +59,27 @@ describe('Chrome', () => {
const component = create(<Chrome {...defaultProps} />);
const instance = component.getInstance();

expect(instance.state.headerHeight).toBe(0);
expect(instance.state.headerHeight).toBe(200);
expect(component).toMatchSnapshot();

Chrome.prototype.getHeaderSize.mockReturnValue(250);
triggerEvent('signin ready');

expect(instance.state.headerHeight).toBe(200);
expect(instance.state.headerHeight).toBe(250);
expect(component).toMatchSnapshot();
});

it('correctly sets the header size when the "signup ready" event is triggered', () => {
const component = create(<Chrome {...defaultProps} />);
const instance = component.getInstance();

expect(instance.state.headerHeight).toBe(0);
expect(instance.state.headerHeight).toBe(200);
expect(component).toMatchSnapshot();
Chrome.prototype.getHeaderSize.mockReturnValue(250);

triggerEvent('signup ready');

expect(instance.state.headerHeight).toBe(200);
expect(instance.state.headerHeight).toBe(250);
expect(component).toMatchSnapshot();
});

Expand Down
2 changes: 2 additions & 0 deletions src/ui/box/chrome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default class Chrome extends React.Component {
this.state = { moving: false, reverse: false, headerHeight: 0 };
}

// eslint-disable-next-line react/no-deprecated
componentWillReceiveProps(nextProps) {
const { auxiliaryPane, showSubmitButton } = this.props;
const { delayingShowSubmitButton } = this.state;
Expand Down Expand Up @@ -151,6 +152,7 @@ export default class Chrome extends React.Component {

l.handleEvent(m, 'signup ready', fn);
l.handleEvent(m, 'signin ready', fn);
fn();
}

onWillSlide() {
Expand Down
2 changes: 1 addition & 1 deletion src/ui/box/container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const badgeSvg = (

const BottomBadge = ({ link }) => (
<span className="auth0-lock-badge-bottom">
<a href={link} target="_blank" className="auth0-lock-badge">
<a href={link} target="_blank" className="auth0-lock-badge" rel="noopener noreferrer">
Protected with {badgeSvg}
</a>
</span>
Expand Down
1 change: 1 addition & 0 deletions src/ui/box/multisize_slide.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class Slider extends React.Component {
this.state = { children: { current: props.children } };
}

// eslint-disable-next-line react/no-deprecated
componentWillReceiveProps(nextProps) {
// TODO: take a prop to identify what are we rendering instead of
// infering it from children keys so we can accept more than one
Expand Down