implement full load of videos and startdata
modify api where necessary
This commit is contained in:
@ -4,13 +4,13 @@ import ActorTile from './ActorTile';
|
||||
|
||||
describe('<ActorTile/>', function () {
|
||||
it('renders without crashing ', function () {
|
||||
const wrapper = shallow(<ActorTile actor={{thumbnail: '-1', name: 'testname', id: 3}}/>);
|
||||
const wrapper = shallow(<ActorTile actor={{Thumbnail: '-1', Name: 'testname', id: 3}}/>);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('simulate click with custom handler', function () {
|
||||
const func = jest.fn((_) => {});
|
||||
const wrapper = shallow(<ActorTile actor={{thumbnail: '-1', name: 'testname', id: 3}} onClick={() => func()}/>);
|
||||
const wrapper = shallow(<ActorTile actor={{Thumbnail: '-1', Name: 'testname', id: 3}} onClick={() => func()}/>);
|
||||
|
||||
const func1 = jest.fn();
|
||||
prepareViewBinding(func1);
|
||||
|
@ -22,7 +22,7 @@ class ActorTile extends React.Component<props> {
|
||||
return this.renderActorTile(this.props.onClick);
|
||||
} else {
|
||||
return (
|
||||
<Link to={{pathname: '/actors/' + this.props.actor.actor_id}}>
|
||||
<Link to={{pathname: '/actors/' + this.props.actor.ActorId}}>
|
||||
{this.renderActorTile(() => {
|
||||
})}
|
||||
</Link>
|
||||
@ -34,11 +34,11 @@ class ActorTile extends React.Component<props> {
|
||||
return (
|
||||
<div className={style.actortile} onClick={(): void => customclickhandler(this.props.actor)}>
|
||||
<div className={style.actortile_thumbnail}>
|
||||
{this.props.actor.thumbnail === null ? <FontAwesomeIcon style={{
|
||||
{this.props.actor.Thumbnail === '' ? <FontAwesomeIcon style={{
|
||||
lineHeight: '130px'
|
||||
}} icon={faUser} size='5x'/> : 'dfdf' /* todo render picture provided here! */}
|
||||
</div>
|
||||
<div className={style.actortile_name}>{this.props.actor.name}</div>
|
||||
<div className={style.actortile_name}>{this.props.actor.Name}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ describe('<AddActorPopup/>', function () {
|
||||
});
|
||||
|
||||
it('test api call and insertion of actor tiles', function () {
|
||||
global.callAPIMock([{id: 1, name: 'test'}, {id: 2, name: 'test2'}]);
|
||||
global.callAPIMock([{Id: 1, Name: 'test'}, {Id: 2, Name: 'test2'}]);
|
||||
|
||||
const wrapper = shallow(<AddActorPopup/>);
|
||||
|
||||
@ -44,7 +44,7 @@ describe('<AddActorPopup/>', function () {
|
||||
|
||||
global.callAPIMock({result: 'success'});
|
||||
|
||||
wrapper.setState({actors: [{actor_id: 1, name: 'test'}]}, () => {
|
||||
wrapper.setState({actors: [{ActorId: 1, Name: 'test'}]}, () => {
|
||||
wrapper.find('ActorTile').dive().simulate('click');
|
||||
|
||||
expect(callAPI).toHaveBeenCalledTimes(1);
|
||||
@ -59,7 +59,7 @@ describe('<AddActorPopup/>', function () {
|
||||
|
||||
global.callAPIMock({result: 'nosuccess'});
|
||||
|
||||
wrapper.setState({actors: [{actor_id: 1, name: 'test'}]}, () => {
|
||||
wrapper.setState({actors: [{ActorId: 1, Name: 'test'}]}, () => {
|
||||
wrapper.find('ActorTile').dive().simulate('click');
|
||||
|
||||
expect(callAPI).toHaveBeenCalledTimes(1);
|
||||
@ -80,7 +80,7 @@ describe('<AddActorPopup/>', function () {
|
||||
|
||||
callAPIMock({});
|
||||
|
||||
wrapper.setState({actors: [{name: 'test', actor_id: 1}]});
|
||||
wrapper.setState({actors: [{Name: 'test', ActorId: 1}]});
|
||||
|
||||
wrapper.find('PopupBase').props().ParentSubmit();
|
||||
|
||||
|
@ -134,8 +134,8 @@ class AddActorPopup extends React.Component<props, state> {
|
||||
// fetch the available actors
|
||||
callAPI<GeneralSuccess>(APINode.Actor, {
|
||||
action: 'addActorToVideo',
|
||||
actorid: actor.actor_id,
|
||||
videoid: this.props.movie_id
|
||||
ActorId: actor.ActorId,
|
||||
MovieId: this.props.movie_id
|
||||
}, result => {
|
||||
if (result.result === 'success') {
|
||||
// return back to player page
|
||||
@ -170,7 +170,7 @@ class AddActorPopup extends React.Component<props, state> {
|
||||
* @param actor
|
||||
*/
|
||||
private filterSearch(actor: ActorType): boolean {
|
||||
return actor.name.toLowerCase().includes(this.state.filter.toLowerCase());
|
||||
return actor.Name.toLowerCase().includes(this.state.filter.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@ describe('<AddTagPopup/>', function () {
|
||||
it('test tag insertion', function () {
|
||||
const wrapper = shallow(<AddTagPopup/>);
|
||||
wrapper.setState({
|
||||
items: [{tag_id: 1, tag_name: 'test'}, {tag_id: 2, tag_name: 'ee'}]
|
||||
items: [{TagId: 1, TagName: 'test'}, {TagId: 2, TagName: 'ee'}]
|
||||
}, () => {
|
||||
expect(wrapper.find('Tag')).toHaveLength(2);
|
||||
expect(wrapper.find('Tag').first().dive().text()).toBe('test');
|
||||
|
@ -39,7 +39,7 @@ class AddTagPopup extends React.Component<props, state> {
|
||||
this.state.items.map((i) => (
|
||||
<Tag tagInfo={i}
|
||||
onclick={(): void => {
|
||||
this.props.submit(i.tag_id, i.tag_name);
|
||||
this.props.submit(i.TagId, i.TagName);
|
||||
this.props.onHide();
|
||||
}}/>
|
||||
)) : null}
|
||||
|
@ -29,7 +29,7 @@ class NewTagPopup extends React.Component<props> {
|
||||
* store the filled in form to the backend
|
||||
*/
|
||||
storeselection(): void {
|
||||
callAPI(APINode.Tags, {action: 'createTag', tagname: this.value}, (result: GeneralSuccess) => {
|
||||
callAPI(APINode.Tags, {action: 'createTag', TagName: this.value}, (result: GeneralSuccess) => {
|
||||
if (result.result !== 'success') {
|
||||
console.log('error occured while writing to db -- todo error handling');
|
||||
console.log(result.result);
|
||||
|
@ -6,12 +6,12 @@ import {shallow} from 'enzyme';
|
||||
|
||||
describe('<Tag/>', function () {
|
||||
it('renders without crashing ', function () {
|
||||
const wrapper = shallow(<Tag tagInfo={{tag_name: 'testname', tag_id: 1}}/>);
|
||||
const wrapper = shallow(<Tag tagInfo={{TagName: 'testname', TagId: 1}}/>);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('renders childs correctly', function () {
|
||||
const wrapper = shallow(<Tag tagInfo={{tag_name: 'test', tag_id: 1}}/>);
|
||||
const wrapper = shallow(<Tag tagInfo={{TagName: 'test', TagId: 1}}/>);
|
||||
expect(wrapper.children().text()).toBe('test');
|
||||
});
|
||||
|
||||
@ -19,7 +19,7 @@ describe('<Tag/>', function () {
|
||||
const func = jest.fn();
|
||||
|
||||
const wrapper = shallow(<Tag
|
||||
tagInfo={{tag_name: 'test', tag_id: 1}}
|
||||
tagInfo={{TagName: 'test', TagId: 1}}
|
||||
onclick={() => {func();}}>test</Tag>);
|
||||
|
||||
expect(func).toBeCalledTimes(0);
|
||||
|
@ -18,7 +18,7 @@ class Tag extends React.Component<props> {
|
||||
return this.renderButton();
|
||||
} else {
|
||||
return (
|
||||
<Link to={'/categories/' + this.props.tagInfo.tag_id}>
|
||||
<Link to={'/categories/' + this.props.tagInfo.TagId}>
|
||||
{this.renderButton()}
|
||||
</Link>
|
||||
);
|
||||
@ -28,7 +28,7 @@ class Tag extends React.Component<props> {
|
||||
renderButton(): JSX.Element {
|
||||
return (
|
||||
<button className={styles.tagbtn} onClick={(): void => this.TagClick()}
|
||||
data-testid='Test-Tag'>{this.props.tagInfo.tag_name}</button>
|
||||
data-testid='Test-Tag'>{this.props.tagInfo.TagName}</button>
|
||||
);
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ class Tag extends React.Component<props> {
|
||||
TagClick(): void {
|
||||
if (this.props.onclick) {
|
||||
// call custom onclick handling
|
||||
this.props.onclick(this.props.tagInfo.tag_name); // todo check if param is neccessary
|
||||
this.props.onclick(this.props.tagInfo.TagName); // todo check if param is neccessary
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -40,9 +40,9 @@ class VideoContainer extends React.Component<props, state> {
|
||||
<div className={style.maincontent}>
|
||||
{this.state.loadeditems.map(elem => (
|
||||
<Preview
|
||||
key={elem.movie_id}
|
||||
name={elem.movie_name}
|
||||
movie_id={elem.movie_id}/>
|
||||
key={elem.MovieId}
|
||||
name={elem.MovieName}
|
||||
movie_id={elem.MovieId}/>
|
||||
))}
|
||||
{/*todo css for no items to show*/}
|
||||
{this.state.loadeditems.length === 0 ?
|
||||
|
Reference in New Issue
Block a user