reformattings
no redirect on tagclick on homepage no multiple add of same tag possible
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import {shallow} from "enzyme";
|
||||
import React from "react";
|
||||
import Player from "./Player";
|
||||
import {shallow} from 'enzyme';
|
||||
import React from 'react';
|
||||
import Player from './Player';
|
||||
|
||||
describe('<Player/>', function () {
|
||||
it('renders without crashing ', function () {
|
||||
@ -16,11 +16,11 @@ describe('<Player/>', function () {
|
||||
{
|
||||
src: '/tstvid.mp4',
|
||||
type: 'video/mp4',
|
||||
size: 1080,
|
||||
size: 1080
|
||||
}
|
||||
]
|
||||
});
|
||||
expect(wrapper.find("r")).toHaveLength(1);
|
||||
expect(wrapper.find('r')).toHaveLength(1);
|
||||
});
|
||||
|
||||
function simulateLikeButtonClick() {
|
||||
@ -28,7 +28,7 @@ describe('<Player/>', function () {
|
||||
|
||||
// initial fetch for getting movie data
|
||||
expect(global.fetch).toHaveBeenCalledTimes(1);
|
||||
wrapper.find('.videoactions').find("button").first().simulate('click');
|
||||
wrapper.find('.videoactions').find('button').first().simulate('click');
|
||||
// fetch for liking
|
||||
expect(global.fetch).toHaveBeenCalledTimes(2);
|
||||
|
||||
@ -69,20 +69,20 @@ describe('<Player/>', function () {
|
||||
|
||||
it('show tag popup', function () {
|
||||
const wrapper = shallow(<Player/>);
|
||||
expect(wrapper.find("AddTagPopup")).toHaveLength(0);
|
||||
expect(wrapper.find('AddTagPopup')).toHaveLength(0);
|
||||
// todo dynamic button find without index
|
||||
wrapper.find('.videoactions').find("button").at(1).simulate('click');
|
||||
wrapper.find('.videoactions').find('button').at(1).simulate('click');
|
||||
// addtagpopup should be showing now
|
||||
expect(wrapper.find("AddTagPopup")).toHaveLength(1);
|
||||
expect(wrapper.find('AddTagPopup')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('test delete button', done => {
|
||||
const wrapper = shallow(<Player viewbinding={{
|
||||
returnToLastElement: jest.fn()
|
||||
}}/>);
|
||||
global.fetch = prepareFetchApi({result: "success"});
|
||||
global.fetch = prepareFetchApi({result: 'success'});
|
||||
|
||||
wrapper.find('.videoactions').find("button").at(2).simulate('click');
|
||||
wrapper.find('.videoactions').find('button').at(2).simulate('click');
|
||||
|
||||
process.nextTick(() => {
|
||||
// refetch is called so fetch called 3 times
|
||||
@ -101,7 +101,7 @@ describe('<Player/>', function () {
|
||||
wrapper.setProps({
|
||||
viewbinding: {
|
||||
returnToLastElement: () => {
|
||||
func()
|
||||
func();
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -115,7 +115,7 @@ describe('<Player/>', function () {
|
||||
it('inserts Tags correctly', function () {
|
||||
const wrapper = shallow(<Player/>);
|
||||
|
||||
expect(wrapper.find("Tag")).toHaveLength(0);
|
||||
expect(wrapper.find('Tag')).toHaveLength(0);
|
||||
|
||||
wrapper.setState({
|
||||
tags: [
|
||||
@ -124,7 +124,7 @@ describe('<Player/>', function () {
|
||||
]
|
||||
});
|
||||
|
||||
expect(wrapper.find("Tag")).toHaveLength(2);
|
||||
expect(wrapper.find('Tag')).toHaveLength(2);
|
||||
});
|
||||
|
||||
it('inserts tag quickadd correctly', function () {
|
||||
@ -137,7 +137,7 @@ describe('<Player/>', function () {
|
||||
global.fetch = prepareFetchApi({result: 'success'});
|
||||
|
||||
// render tag subcomponent
|
||||
const tag = wrapper.find("Tag").first().dive();
|
||||
const tag = wrapper.find('Tag').first().dive();
|
||||
tag.simulate('click');
|
||||
|
||||
process.nextTick(() => {
|
||||
@ -155,7 +155,7 @@ describe('<Player/>', function () {
|
||||
global.console.error = jest.fn();
|
||||
|
||||
// render tag subcomponent
|
||||
const tag = wrapper.find("Tag").first().dive();
|
||||
const tag = wrapper.find('Tag').first().dive();
|
||||
tag.simulate('click');
|
||||
|
||||
process.nextTick(() => {
|
||||
@ -169,15 +169,15 @@ describe('<Player/>', function () {
|
||||
function generatetag() {
|
||||
const wrapper = shallow(<Player/>);
|
||||
|
||||
expect(wrapper.find("Tag")).toHaveLength(0);
|
||||
expect(wrapper.find('Tag')).toHaveLength(0);
|
||||
|
||||
wrapper.setState({
|
||||
suggesttag: [
|
||||
{tag_name: 'first', tag_id: 1},
|
||||
{tag_name: 'first', tag_id: 1}
|
||||
]
|
||||
});
|
||||
|
||||
expect(wrapper.find("Tag")).toHaveLength(1);
|
||||
expect(wrapper.find('Tag')).toHaveLength(1);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
|
Reference in New Issue
Block a user