diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/permission-templates/components')
3 files changed, 46 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx index 9b040c23812..f3eb1a147d9 100644 --- a/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/Form.tsx @@ -20,17 +20,17 @@ import * as React from 'react'; import DeferredSpinner from '../../../components/common/DeferredSpinner'; import SimpleModal from '../../../components/controls/SimpleModal'; -import { translate } from '../../../helpers/l10n'; import { SubmitButton, ResetButtonLink } from '../../../components/ui/buttons'; +import { translate } from '../../../helpers/l10n'; interface Props { confirmButtonText: string; header: string; - permissionTemplate?: { description?: string; name: string; projectKeyPattern?: string }; onClose: () => void; onSubmit: ( data: { description: string; name: string; projectKeyPattern: string } ) => Promise<void>; + permissionTemplate?: { description?: string; name: string; projectKeyPattern?: string }; } interface State { @@ -79,7 +79,8 @@ export default class Form extends React.PureComponent<Props, State> { <SimpleModal header={this.props.header} onClose={this.props.onClose} - onSubmit={this.handleSubmit}> + onSubmit={this.handleSubmit} + size="small"> {({ onCloseClick, onFormSubmit, submitting }) => ( <form id="permission-template-form" onSubmit={onFormSubmit}> <header className="modal-head"> diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Form-test.tsx b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Form-test.tsx new file mode 100644 index 00000000000..1d8dfd32c52 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/Form-test.tsx @@ -0,0 +1,30 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import { shallow } from 'enzyme'; +import Form from '../Form'; + +it('render correctly', () => { + expect( + shallow( + <Form confirmButtonText="confirm" header="title" onClose={jest.fn()} onSubmit={jest.fn()} /> + ) + ).toMatchSnapshot(); +}); diff --git a/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/__snapshots__/Form-test.tsx.snap b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/__snapshots__/Form-test.tsx.snap new file mode 100644 index 00000000000..81c1df3dd78 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/permission-templates/components/__tests__/__snapshots__/Form-test.tsx.snap @@ -0,0 +1,12 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`render correctly 1`] = ` +<SimpleModal + header="title" + onClose={[MockFunction]} + onSubmit={[Function]} + size="small" +> + <Component /> +</SimpleModal> +`; |