diff options
Diffstat (limited to 'ui-react/src/components/dialogs')
-rw-r--r-- | ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap | 4 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/ViewToscaModal/ViewToscaModal.js (renamed from ui-react/src/components/dialogs/ViewToscaModals/ViewToscaModals.js) | 38 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/ViewToscaModal/ViewToscaModal.test.js (renamed from ui-react/src/components/dialogs/ViewToscaModals/ViewToscaModals.test.js) | 14 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/ViewToscaModal/__snapshots__/ViewToscaModal.test.js.snap (renamed from ui-react/src/components/dialogs/ViewToscaModals/__snapshots__/ViewToscaModals.test.js.snap) | 8 |
4 files changed, 29 insertions, 35 deletions
diff --git a/ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap b/ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap index 5fd9e8aa5..9e7222415 100644 --- a/ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap +++ b/ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap @@ -57,9 +57,7 @@ exports[`Verify OpenLoopModal Test the render method 1`] = ` title="" type="checkbox" > - <FormCheckLabel - type="checkbox" - > + <FormCheckLabel> Read Only </FormCheckLabel> <Styled(FormCheckInput) diff --git a/ui-react/src/components/dialogs/ViewToscaModals/ViewToscaModals.js b/ui-react/src/components/dialogs/ViewToscaModal/ViewToscaModal.js index 8073dc357..fbfb4a78c 100644 --- a/ui-react/src/components/dialogs/ViewToscaModals/ViewToscaModals.js +++ b/ui-react/src/components/dialogs/ViewToscaModal/ViewToscaModal.js @@ -26,7 +26,7 @@ import MaterialTable from "material-table"; import Button from 'react-bootstrap/Button'; import Modal from 'react-bootstrap/Modal'; import styled from 'styled-components'; -import TemplateMenu from '../../../api/TemplateMenu'; +import TemplateMenuService from '../../../api/TemplateMenuService'; import ArrowUpward from '@material-ui/icons/ArrowUpward'; import ChevronLeft from '@material-ui/icons/ChevronLeft'; import ChevronRight from '@material-ui/icons/ChevronRight'; @@ -39,15 +39,12 @@ import Search from '@material-ui/icons/Search'; const ModalStyled = styled(Modal)` background-color: transparent; ` -const StyledToscaView = styled.textarea` -` -const StyledToscaDiv = styled.div` -` + const vtmCellStyle = { border: '1px solid black' }; const vtmHeaderStyle = { backgroundColor: '#ddd', border: '2px solid black' }; const vtmRowHeaderStyle = {backgroundColor:'#ddd', fontSize: '15pt', text: 'bold', border: '1px solid black'}; -export default class ViewToscalModals extends React.Component { +export default class ViewToscalModal extends React.Component { state = { show: true, @@ -81,35 +78,34 @@ export default class ViewToscalModals extends React.Component { } ], tableIcons: { - FirstPage: forwardRef((props, ref) => <FirstPage {...props} ref={ref} />), - LastPage: forwardRef((props, ref) => <LastPage {...props} ref={ref} />), - NextPage: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />), - PreviousPage: forwardRef((props, ref) => <ChevronLeft {...props} ref={ref} />), - ResetSearch: forwardRef((props, ref) => <Clear {...props} ref={ref} />), - Search: forwardRef((props, ref) => <Search {...props} ref={ref} />), - SortArrow: forwardRef((props, ref) => <ArrowUpward {...props} ref={ref} />), + FirstPage: forwardRef((props, ref) => <FirstPage {...props} ref={ref} />), + LastPage: forwardRef((props, ref) => <LastPage {...props} ref={ref} />), + NextPage: forwardRef((props, ref) => <ChevronRight {...props} ref={ref} />), + PreviousPage: forwardRef((props, ref) => <ChevronLeft {...props} ref={ref} />), + ResetSearch: forwardRef((props, ref) => <Clear {...props} ref={ref} />), + Search: forwardRef((props, ref) => <Search {...props} ref={ref} />), + SortArrow: forwardRef((props, ref) => <ArrowUpward {...props} ref={ref} />) } }; constructor(props, context) { super(props, context); this.handleClose = this.handleClose.bind(this); - this.getToscaModals = this.getToscaModals.bind(this); + this.getToscaModels = this.getToscaModels.bind(this); this.handleYamlContent = this.handleYamlContent.bind(this); } componentWillMount() { - this.getToscaModals(); + this.getToscaModels(); } - getToscaModals() { - TemplateMenu.getToscaModals().then(toscaNames => { + getToscaModels() { + TemplateMenuService.getToscaModels().then(toscaNames => { this.setState({ toscaNames: toscaNames }); }); } handleYamlContent(event) { - console.log('inside handleYamlContent'); this.setState({ content: event.target.value }); } @@ -138,9 +134,9 @@ export default class ViewToscalModals extends React.Component { }) }} /> - <StyledToscaDiv> - <StyledToscaView value={this.state.content} onChange={this.handleYamlContent}/> - </StyledToscaDiv> + <div> + <textarea value={this.state.content} onChange={this.handleYamlContent}/> + </div> </Modal.Body> <Modal.Footer> <Button variant="secondary" onClick={this.handleClose}>Close</Button> diff --git a/ui-react/src/components/dialogs/ViewToscaModals/ViewToscaModals.test.js b/ui-react/src/components/dialogs/ViewToscaModal/ViewToscaModal.test.js index 4284dd3ed..4dbe37615 100644 --- a/ui-react/src/components/dialogs/ViewToscaModals/ViewToscaModals.test.js +++ b/ui-react/src/components/dialogs/ViewToscaModal/ViewToscaModal.test.js @@ -22,11 +22,11 @@ */ import React from 'react'; import { shallow } from 'enzyme'; -import ViewToscaModals from './ViewToscaModals'; +import ViewToscaModal from './ViewToscaModal'; import { mount } from 'enzyme'; -describe('Verify ViewToscaModals', () => { +describe('Verify ViewToscaModal', () => { beforeEach(() => { fetch.resetMocks(); fetch.mockImplementation(() => { @@ -49,7 +49,7 @@ describe('Verify ViewToscaModals', () => { }); it('Test the tosca model view render method', () => { - const component = shallow(<ViewToscaModals/>); + const component = shallow(<ViewToscaModal/>); component.setState({ toscaNames: { "index": "1", "toscaModelYaml": "MTCA", @@ -64,22 +64,22 @@ describe('Verify ViewToscaModals', () => { }); it('Test Table icons', () => { - const component = mount(<ViewToscaModals/>); + const component = mount(<ViewToscaModal/>); expect(component.find('[className="MuiSelect-icon MuiTablePagination-selectIcon"]')).toBeTruthy(); }); it('Test handleYamlContent', () => { const yamlContent = 'MTCA Tosca model details'; - const component = shallow(<ViewToscaModals/>); + const component = shallow(<ViewToscaModal/>); component.find('[value="Please select Tosca model to view the details"]').prop('onChange')({ target: { value: yamlContent }}); expect(component.state('content')).toEqual(yamlContent); }); it('Test handleClose', () => { const historyMock = { push: jest.fn() }; - const handleClose = jest.spyOn(ViewToscaModals.prototype,'handleClose'); - const component = shallow(<ViewToscaModals history={historyMock} />) + const handleClose = jest.spyOn(ViewToscaModal.prototype,'handleClose'); + const component = shallow(<ViewToscaModal history={historyMock} />) component.find('[variant="secondary"]').prop('onClick')(); expect(handleClose).toHaveBeenCalledTimes(1); expect(component.state('show')).toEqual(false); diff --git a/ui-react/src/components/dialogs/ViewToscaModals/__snapshots__/ViewToscaModals.test.js.snap b/ui-react/src/components/dialogs/ViewToscaModal/__snapshots__/ViewToscaModal.test.js.snap index 55137b928..3523adad3 100644 --- a/ui-react/src/components/dialogs/ViewToscaModals/__snapshots__/ViewToscaModals.test.js.snap +++ b/ui-react/src/components/dialogs/ViewToscaModal/__snapshots__/ViewToscaModal.test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Verify ViewToscaModals Test the tosca model view render method 1`] = ` +exports[`Verify ViewToscaModal Test the tosca model view render method 1`] = ` <Styled(Bootstrap(Modal)) onHide={[Function]} show={true} @@ -147,12 +147,12 @@ exports[`Verify ViewToscaModals Test the tosca model view render method 1`] = ` } title="View ToscaModel" /> - <styled.div> - <styled.textarea + <div> + <textarea onChange={[Function]} value="Please select Tosca model to view the details" /> - </styled.div> + </div> </ModalBody> <ModalFooter> <Button |