Skip to content

Commit

Permalink
Review#3: rename BasicLoginForm to LoginForm component.
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin committed Mar 20, 2020
1 parent 5b189c2 commit db2f4b3
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { BasicLoginForm } from './basic_login_form';
export { LoginForm } from './login_form';
export { DisabledLoginForm } from './disabled_login_form';

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export { BasicLoginForm } from './basic_login_form';
export { LoginForm } from './login_form';
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import React from 'react';
import { act } from '@testing-library/react';
import { EuiButton, EuiCallOut } from '@elastic/eui';
import { mountWithIntl, nextTick, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { BasicLoginForm } from './basic_login_form';
import { LoginForm } from './login_form';

import { coreMock } from '../../../../../../../../src/core/public/mocks';

describe('BasicLoginForm', () => {
describe('LoginForm', () => {
beforeAll(() => {
Object.defineProperty(window, 'location', {
value: { href: 'https://some-host/bar' },
Expand All @@ -28,7 +28,7 @@ describe('BasicLoginForm', () => {
const coreStartMock = coreMock.createStart();
expect(
shallowWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
loginAssistanceMessage=""
Expand All @@ -42,7 +42,7 @@ describe('BasicLoginForm', () => {
it('renders an info message when provided.', () => {
const coreStartMock = coreMock.createStart();
const wrapper = shallowWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
infoMessage={'Hey this is an info message'}
Expand All @@ -60,7 +60,7 @@ describe('BasicLoginForm', () => {
coreStartMock.http.post.mockRejectedValue({ response: { status: 401 } });

const wrapper = mountWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
loginAssistanceMessage=""
Expand Down Expand Up @@ -88,7 +88,7 @@ describe('BasicLoginForm', () => {
coreStartMock.http.post.mockRejectedValue({ response: { status: 500 } });

const wrapper = mountWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
loginAssistanceMessage=""
Expand Down Expand Up @@ -117,7 +117,7 @@ describe('BasicLoginForm', () => {
coreStartMock.http.post.mockResolvedValue({});

const wrapper = mountWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
loginAssistanceMessage=""
Expand Down Expand Up @@ -149,7 +149,7 @@ describe('BasicLoginForm', () => {
const coreStartMock = coreMock.createStart();
expect(
shallowWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
loginAssistanceMessage=""
Expand All @@ -170,7 +170,7 @@ describe('BasicLoginForm', () => {
const coreStartMock = coreMock.createStart();
expect(
shallowWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
loginAssistanceMessage=""
Expand Down Expand Up @@ -199,7 +199,7 @@ describe('BasicLoginForm', () => {

window.location.href = currentURL;
const wrapper = mountWithIntl(
<BasicLoginForm
<LoginForm
http={coreStartMock.http}
notifications={coreStartMock.notifications}
loginAssistanceMessage=""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum MessageType {
Danger,
}

export class BasicLoginForm extends Component<Props, State> {
export class LoginForm extends Component<Props, State> {
public state: State = {
loadingState: { type: LoadingStateType.None },
username: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { nextTick } from 'test_utils/enzyme_helpers';
import { LoginState } from '../../../common/login_state';
import { LoginPage } from './login_page';
import { coreMock } from '../../../../../../src/core/public/mocks';
import { DisabledLoginForm, BasicLoginForm } from './components';
import { DisabledLoginForm, LoginForm } from './components';

const createLoginState = (options?: Partial<LoginState>) => {
return {
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('LoginPage', () => {
resetHttpMock(); // so the calls don't show in the BasicLoginForm snapshot
});

expect(wrapper.find(BasicLoginForm)).toMatchSnapshot();
expect(wrapper.find(LoginForm)).toMatchSnapshot();
});

it('renders as expected when info message is set', async () => {
Expand All @@ -226,7 +226,7 @@ describe('LoginPage', () => {
resetHttpMock(); // so the calls don't show in the BasicLoginForm snapshot
});

expect(wrapper.find(BasicLoginForm)).toMatchSnapshot();
expect(wrapper.find(LoginForm)).toMatchSnapshot();
});

it('renders as expected when loginAssistanceMessage is set', async () => {
Expand All @@ -248,7 +248,7 @@ describe('LoginPage', () => {
resetHttpMock(); // so the calls don't show in the BasicLoginForm snapshot
});

expect(wrapper.find(BasicLoginForm)).toMatchSnapshot();
expect(wrapper.find(LoginForm)).toMatchSnapshot();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { CoreStart, FatalErrorsStart, HttpStart, NotificationsStart } from 'src/core/public';
import { LoginState } from '../../../common/login_state';
import { BasicLoginForm, DisabledLoginForm } from './components';
import { LoginForm, DisabledLoginForm } from './components';

interface Props {
http: HttpStart;
Expand Down Expand Up @@ -220,7 +220,7 @@ export class LoginPage extends Component<Props, State> {
}

return (
<BasicLoginForm
<LoginForm
http={this.props.http}
notifications={this.props.notifications}
showLoginForm={showLoginForm}
Expand Down

0 comments on commit db2f4b3

Please sign in to comment.