From 280f8015d06af1f41a3ef12e8300801c7a5e0d54 Mon Sep 17 00:00:00 2001 From: AviZi Date: Fri, 9 Jun 2017 02:39:56 +0300 Subject: [SDC-29] Amdocs OnBoard 1707 initial commit. Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370 Signed-off-by: AviZi --- .../nfvo-components/listEditor/listEditor.test.js | 60 ++++++++++------------ 1 file changed, 26 insertions(+), 34 deletions(-) (limited to 'openecomp-ui/test/nfvo-components/listEditor') diff --git a/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js b/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js index a3b098f611..c1f823c3fc 100644 --- a/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js +++ b/openecomp-ui/test/nfvo-components/listEditor/listEditor.test.js @@ -1,25 +1,21 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ +/*! * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express + * or implied. See the License for the specific language governing + * permissions and limitations under the License. */ -import expect from 'expect'; import React from 'react'; +import {mount} from 'enzyme'; import TestUtils from 'react-addons-test-utils'; import ListEditorView from 'src/nfvo-components/listEditor/ListEditorView.jsx'; import ListEditorItemView from 'src/nfvo-components/listEditor/ListEditorItemView.jsx'; @@ -28,11 +24,11 @@ describe('listEditor Module Tests', function () { it('list editor view should exist', () => { - expect(ListEditorView).toExist(); + expect(ListEditorView).toBeTruthy(); }); it('list editor item view should exist', () => { - expect(ListEditorItemView).toExist(); + expect(ListEditorItemView).toBeTruthy(); }); it('should render list and list item and call onEdit', done => { @@ -43,22 +39,18 @@ describe('listEditor Module Tests', function () { ); - expect(itemView).toExist(); - let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'fa-sliders'); + expect(itemView).toBeTruthy(); + let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'sliders'); TestUtils.Simulate.click(sliderIcon); }); - it('should render list and list item and call onFilter', done => { - let itemView = TestUtils.renderIntoDocument( - {done();}}> - -
-
-
+ it('should render list and list item and call onFilter', () => { + let itemView = mount( + {}} children={[()]} /> ); - expect(itemView).toExist(); - let filterInput = TestUtils.findRenderedDOMComponentWithTag(itemView, 'input'); - TestUtils.Simulate.change(filterInput); + expect(itemView).toBeTruthy(); + let inputComponent = itemView.find('ExpandableInput'); + expect(inputComponent.length).toBe(1); }); it('should render READONLY list item and not call onEdit', done => { @@ -67,8 +59,8 @@ describe('listEditor Module Tests', function () {
); - expect(itemView).toExist(); - let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'fa-sliders'); + expect(itemView).toBeTruthy(); + let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'sliders'); TestUtils.Simulate.click(sliderIcon); }); @@ -78,8 +70,8 @@ describe('listEditor Module Tests', function () {
); - expect(itemView).toExist(); - let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'fa-trash-o'); + expect(itemView).toBeTruthy(); + let sliderIcon = TestUtils.findRenderedDOMComponentWithClass(itemView, 'trash-o'); TestUtils.Simulate.click(sliderIcon); }); @@ -89,8 +81,8 @@ describe('listEditor Module Tests', function () {
); - expect(itemView).toExist(); - let sliderIcon = TestUtils.scryRenderedDOMComponentsWithClass(itemView, 'fa-trash-o'); - expect(sliderIcon).toEqual(0); + expect(itemView).toBeTruthy(); + let trashIcon = TestUtils.scryRenderedDOMComponentsWithClass(itemView, 'fa-trash-o'); + expect(trashIcon).toEqual([]); }); }); -- cgit 1.2.3-korg