mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
[MM-54832] Convert LocalizedInput of 'password_reset_send_link.tsx' to regular input component (#25018)
This commit is contained in:
parent
342b20ba54
commit
745e5252ab
@ -28,17 +28,11 @@ exports[`components/PasswordResetSendLink should match snapshot 1`] = `
|
||||
<div
|
||||
className="form-group"
|
||||
>
|
||||
<LocalizedInput
|
||||
<input
|
||||
autoFocus={true}
|
||||
className="form-control"
|
||||
id="passwordResetEmailInput"
|
||||
name="email"
|
||||
placeholder={
|
||||
Object {
|
||||
"defaultMessage": "Email",
|
||||
"id": "password_send.email",
|
||||
}
|
||||
}
|
||||
spellCheck="false"
|
||||
type="email"
|
||||
/>
|
||||
|
@ -5,15 +5,18 @@ import {shallow} from 'enzyme';
|
||||
import React from 'react';
|
||||
import {MemoryRouter} from 'react-router-dom';
|
||||
|
||||
import {mountWithIntl} from 'tests/helpers/intl-test-helper';
|
||||
import {mountWithIntl, type MockIntl} from 'tests/helpers/intl-test-helper';
|
||||
|
||||
import PasswordResetSendLink from './password_reset_send_link';
|
||||
import {PasswordResetSendLink} from './password_reset_send_link';
|
||||
|
||||
describe('components/PasswordResetSendLink', () => {
|
||||
const baseProps = {
|
||||
actions: {
|
||||
sendPasswordResetEmail: jest.fn().mockResolvedValue({data: true}),
|
||||
},
|
||||
intl: {
|
||||
formatMessage: jest.fn(),
|
||||
} as MockIntl,
|
||||
};
|
||||
|
||||
it('should match snapshot', () => {
|
||||
|
@ -2,21 +2,19 @@
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React from 'react';
|
||||
import {FormattedMessage} from 'react-intl';
|
||||
import {FormattedMessage, injectIntl, type IntlShape} from 'react-intl';
|
||||
|
||||
import type {ServerError} from '@mattermost/types/errors';
|
||||
|
||||
import {isEmail} from 'mattermost-redux/utils/helpers';
|
||||
|
||||
import BackButton from 'components/common/back_button';
|
||||
import LocalizedInput from 'components/localized_input/localized_input';
|
||||
|
||||
import {t} from 'utils/i18n';
|
||||
|
||||
interface Props {
|
||||
actions: {
|
||||
sendPasswordResetEmail: (email: string) => Promise<{data: any; error: ServerError}>;
|
||||
};
|
||||
intl: IntlShape;
|
||||
}
|
||||
|
||||
interface State {
|
||||
@ -24,7 +22,7 @@ interface State {
|
||||
updateText: React.ReactNode;
|
||||
}
|
||||
|
||||
export default class PasswordResetSendLink extends React.PureComponent<Props, State> {
|
||||
export class PasswordResetSendLink extends React.PureComponent<Props, State> {
|
||||
state = {
|
||||
error: null,
|
||||
updateText: null,
|
||||
@ -123,15 +121,15 @@ export default class PasswordResetSendLink extends React.PureComponent<Props, St
|
||||
/>
|
||||
</p>
|
||||
<div className={formClass}>
|
||||
<LocalizedInput
|
||||
<input
|
||||
id='passwordResetEmailInput'
|
||||
type='email'
|
||||
className='form-control'
|
||||
name='email'
|
||||
placeholder={{
|
||||
id: t('password_send.email'),
|
||||
placeholder={this.props.intl.formatMessage({
|
||||
id: 'password_send.email',
|
||||
defaultMessage: 'Email',
|
||||
}}
|
||||
})}
|
||||
ref={this.emailInput}
|
||||
spellCheck='false'
|
||||
autoFocus={true}
|
||||
@ -155,3 +153,5 @@ export default class PasswordResetSendLink extends React.PureComponent<Props, St
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default injectIntl(PasswordResetSendLink);
|
||||
|
@ -114,3 +114,7 @@ export function mountWithIntl<T extends ReactElement | IntlInjectedElement>(elem
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
export interface MockIntl extends IntlShape {
|
||||
formatMessage: jest.Mock;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user