From db2f4b30f1058e098b178ecfbbb4f00b62354cc3 Mon Sep 17 00:00:00 2001 From: Aleh Zasypkin Date: Fri, 20 Mar 2020 09:56:40 +0100 Subject: [PATCH] Review#3: rename `BasicLoginForm` to `LoginForm` component. --- .../__snapshots__/login_page.test.tsx.snap | 8 ++++---- .../authentication/login/components/index.ts | 2 +- .../__snapshots__/login_form.test.tsx.snap} | 6 +++--- .../{basic_login_form => login_form}/index.ts | 2 +- .../login_form.test.tsx} | 20 +++++++++---------- .../login_form.tsx} | 2 +- .../authentication/login/login_page.test.tsx | 8 ++++---- .../authentication/login/login_page.tsx | 4 ++-- 8 files changed, 26 insertions(+), 26 deletions(-) rename x-pack/plugins/security/public/authentication/login/components/{basic_login_form/__snapshots__/basic_login_form.test.tsx.snap => login_form/__snapshots__/login_form.test.tsx.snap} (95%) rename x-pack/plugins/security/public/authentication/login/components/{basic_login_form => login_form}/index.ts (82%) rename x-pack/plugins/security/public/authentication/login/components/{basic_login_form/basic_login_form.test.tsx => login_form/login_form.test.tsx} (96%) rename x-pack/plugins/security/public/authentication/login/components/{basic_login_form/basic_login_form.tsx => login_form/login_form.tsx} (99%) diff --git a/x-pack/plugins/security/public/authentication/login/__snapshots__/login_page.test.tsx.snap b/x-pack/plugins/security/public/authentication/login/__snapshots__/login_page.test.tsx.snap index 37c5c635851a0..0eccd4692d26e 100644 --- a/x-pack/plugins/security/public/authentication/login/__snapshots__/login_page.test.tsx.snap +++ b/x-pack/plugins/security/public/authentication/login/__snapshots__/login_page.test.tsx.snap @@ -96,7 +96,7 @@ exports[`LoginPage disabled form states renders as expected when xpack is not av `; exports[`LoginPage enabled form state renders as expected 1`] = ` - - `; -exports[`BasicLoginForm login selector renders as expected without login form 1`] = ` +exports[`LoginForm login selector renders as expected without login form 1`] = ` `; -exports[`BasicLoginForm renders as expected 1`] = ` +exports[`LoginForm renders as expected 1`] = `
{ +describe('LoginForm', () => { beforeAll(() => { Object.defineProperty(window, 'location', { value: { href: 'https://some-host/bar' }, @@ -28,7 +28,7 @@ describe('BasicLoginForm', () => { const coreStartMock = coreMock.createStart(); expect( shallowWithIntl( - { it('renders an info message when provided.', () => { const coreStartMock = coreMock.createStart(); const wrapper = shallowWithIntl( - { coreStartMock.http.post.mockRejectedValue({ response: { status: 401 } }); const wrapper = mountWithIntl( - { coreStartMock.http.post.mockRejectedValue({ response: { status: 500 } }); const wrapper = mountWithIntl( - { coreStartMock.http.post.mockResolvedValue({}); const wrapper = mountWithIntl( - { const coreStartMock = coreMock.createStart(); expect( shallowWithIntl( - { const coreStartMock = coreMock.createStart(); expect( shallowWithIntl( - { window.location.href = currentURL; const wrapper = mountWithIntl( - { +export class LoginForm extends Component { public state: State = { loadingState: { type: LoadingStateType.None }, username: '', diff --git a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx index 17038df18ab07..c4be57d8d7db7 100644 --- a/x-pack/plugins/security/public/authentication/login/login_page.test.tsx +++ b/x-pack/plugins/security/public/authentication/login/login_page.test.tsx @@ -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) => { return { @@ -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 () => { @@ -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 () => { @@ -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(); }); }); diff --git a/x-pack/plugins/security/public/authentication/login/login_page.tsx b/x-pack/plugins/security/public/authentication/login/login_page.tsx index fedbb693f1b39..70f8f76ee0a9c 100644 --- a/x-pack/plugins/security/public/authentication/login/login_page.tsx +++ b/x-pack/plugins/security/public/authentication/login/login_page.tsx @@ -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; @@ -220,7 +220,7 @@ export class LoginPage extends Component { } return ( -