reformattings
no redirect on tagclick on homepage no multiple add of same tag possible
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import App from './App';
|
||||
import {shallow} from 'enzyme'
|
||||
import {shallow} from 'enzyme';
|
||||
|
||||
describe('<App/>', function () {
|
||||
it('renders without crashing ', function () {
|
||||
@@ -24,7 +24,7 @@ describe('<App/>', function () {
|
||||
|
||||
wrapper.instance().changeRootElement(<div id='testit'/>);
|
||||
|
||||
expect(wrapper.find("#testit")).toHaveLength(1);
|
||||
expect(wrapper.find('#testit')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('test hide video again', function () {
|
||||
@@ -33,61 +33,61 @@ describe('<App/>', function () {
|
||||
|
||||
wrapper.instance().changeRootElement(<div id='testit'/>);
|
||||
|
||||
expect(wrapper.find("#testit")).toHaveLength(1);
|
||||
expect(wrapper.find('#testit')).toHaveLength(1);
|
||||
|
||||
wrapper.instance().returnToLastElement();
|
||||
|
||||
expect(wrapper.find("HomePage")).toHaveLength(1);
|
||||
expect(wrapper.find('HomePage')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('test fallback to last loaded page', function () {
|
||||
const wrapper = shallow(<App/>);
|
||||
wrapper.setState({generalSettingsLoaded: true}); // simulate fetch to have already finisheed
|
||||
|
||||
wrapper.find(".navitem").findWhere(t => t.text() === "Random Video" && t.type() === "div").simulate("click");
|
||||
wrapper.find('.navitem').findWhere(t => t.text() === 'Random Video' && t.type() === 'div').simulate('click');
|
||||
|
||||
wrapper.instance().changeRootElement(<div id='testit'/>);
|
||||
|
||||
expect(wrapper.find("#testit")).toHaveLength(1);
|
||||
expect(wrapper.find('#testit')).toHaveLength(1);
|
||||
|
||||
wrapper.instance().returnToLastElement();
|
||||
|
||||
expect(wrapper.find("RandomPage")).toHaveLength(1);
|
||||
expect(wrapper.find('RandomPage')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('test home click', function () {
|
||||
const wrapper = shallow(<App/>);
|
||||
wrapper.setState({generalSettingsLoaded: true}); // simulate fetch to have already finisheed
|
||||
|
||||
wrapper.setState({page: "wrongvalue"});
|
||||
expect(wrapper.find("HomePage")).toHaveLength(0);
|
||||
wrapper.find(".navitem").findWhere(t => t.text() === "Home" && t.type() === "div").simulate("click");
|
||||
expect(wrapper.find("HomePage")).toHaveLength(1);
|
||||
wrapper.setState({page: 'wrongvalue'});
|
||||
expect(wrapper.find('HomePage')).toHaveLength(0);
|
||||
wrapper.find('.navitem').findWhere(t => t.text() === 'Home' && t.type() === 'div').simulate('click');
|
||||
expect(wrapper.find('HomePage')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('test category click', function () {
|
||||
const wrapper = shallow(<App/>);
|
||||
wrapper.setState({generalSettingsLoaded: true}); // simulate fetch to have already finisheed
|
||||
|
||||
expect(wrapper.find("CategoryPage")).toHaveLength(0);
|
||||
wrapper.find(".navitem").findWhere(t => t.text() === "Categories" && t.type() === "div").simulate("click");
|
||||
expect(wrapper.find("CategoryPage")).toHaveLength(1);
|
||||
expect(wrapper.find('CategoryPage')).toHaveLength(0);
|
||||
wrapper.find('.navitem').findWhere(t => t.text() === 'Categories' && t.type() === 'div').simulate('click');
|
||||
expect(wrapper.find('CategoryPage')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('test settings click', function () {
|
||||
const wrapper = shallow(<App/>);
|
||||
wrapper.setState({generalSettingsLoaded: true}); // simulate fetch to have already finisheed
|
||||
|
||||
expect(wrapper.find("SettingsPage")).toHaveLength(0);
|
||||
wrapper.find(".navitem").findWhere(t => t.text() === "Settings" && t.type() === "div").simulate("click");
|
||||
expect(wrapper.find("SettingsPage")).toHaveLength(1);
|
||||
expect(wrapper.find('SettingsPage')).toHaveLength(0);
|
||||
wrapper.find('.navitem').findWhere(t => t.text() === 'Settings' && t.type() === 'div').simulate('click');
|
||||
expect(wrapper.find('SettingsPage')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('test initial fetch from api', done => {
|
||||
global.fetch = global.prepareFetchApi({
|
||||
generalSettingsLoaded: true,
|
||||
passwordsupport: true,
|
||||
mediacentername: "testname"
|
||||
mediacentername: 'testname'
|
||||
});
|
||||
|
||||
const wrapper = shallow(<App/>);
|
||||
|
||||
Reference in New Issue
Block a user