blob: 505bc91636cb14bed1ffd2b5e2e9ae161a982562 [file] [log] [blame]
svishnev1eb66b72018-01-11 14:39:45 +02001/*
2 * Copyright © 2016-2017 European Support Limited
AviZi280f8012017-06-09 02:39:56 +03003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
svishnev1eb66b72018-01-11 14:39:45 +02007 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
AviZi280f8012017-06-09 02:39:56 +030010 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
svishnev1eb66b72018-01-11 14:39:45 +020012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
AviZi280f8012017-06-09 02:39:56 +030015 */
16
17
18import React from 'react';
svishnev1eb66b72018-01-11 14:39:45 +020019import ShallowRenderer from 'react-test-renderer/shallow';
20import TestUtils from 'react-dom/test-utils';
AviZi280f8012017-06-09 02:39:56 +030021import TabulatedEditor from 'nfvo-components/editor/TabulatedEditor.jsx';
talig8e9c0652017-12-20 14:30:43 +020022import { Provider } from 'react-redux';
23import {storeCreator} from 'sdc-app/AppStore.js';
AviZi280f8012017-06-09 02:39:56 +030024
25describe('Tabulated Editor test: ', function () {
talig8e9c0652017-12-20 14:30:43 +020026 const store = storeCreator();
AviZi280f8012017-06-09 02:39:56 +030027 it('basic view test', () => {
svishnev1eb66b72018-01-11 14:39:45 +020028 const renderer = new ShallowRenderer();
AviZi280f8012017-06-09 02:39:56 +030029 renderer.render(
talig8e9c0652017-12-20 14:30:43 +020030 <Provider store={store}><TabulatedEditor><button>test</button></TabulatedEditor></Provider>
AviZi280f8012017-06-09 02:39:56 +030031 );
32 let renderedOutput = renderer.getRenderOutput();
33 expect(renderedOutput).toBeTruthy();
34
35 });
36
37 it('handle func test', () => {
38 let props = {
39 navigationBarProps: {
40 groups: [],
41 onNavigationItemClick: ()=>{}
42 },
43 versionControllerProps: {
44 isCheckedOut: false,
45 version: {id: '0.1', label: '0.1'},
46 viewableVersions: [{id: '0.1', label: '0.1'}],
talig8e9c0652017-12-20 14:30:43 +020047 itemPermission: {isCertified: false, isCollaborator: true, isDirty: false},
AviZi280f8012017-06-09 02:39:56 +030048 onSubmit: ()=>{},
49 onRevert: ()=>{}
50 }
51 };
talig8e9c0652017-12-20 14:30:43 +020052 const view = TestUtils.renderIntoDocument(<Provider store={store}><TabulatedEditor {...props}><button>test</button></TabulatedEditor></Provider>);
AviZi280f8012017-06-09 02:39:56 +030053 expect(view).toBeTruthy();
54 });
55
56});