diff --git a/src/elements/Popups/NewActorPopup/NewActorPopup.test.js b/src/elements/Popups/NewActorPopup/NewActorPopup.test.js index d71e3be..f2438e7 100644 --- a/src/elements/Popups/NewActorPopup/NewActorPopup.test.js +++ b/src/elements/Popups/NewActorPopup/NewActorPopup.test.js @@ -25,7 +25,7 @@ describe('', () => { const wrapper = shallow( {func();}}/>); // manually set typed in actorname - wrapper.instance().value = 'testactorname'; + wrapper.instance().nameValue = 'testactorname'; global.fetch = prepareFetchApi({}); @@ -55,6 +55,6 @@ describe('', () => { wrapper.find('input').simulate('change', {target: {value: 'testinput'}}); - expect(wrapper.instance().value).toBe('testinput'); + expect(wrapper.instance().nameValue).toBe('testinput'); }); }); diff --git a/src/pages/Player/Player.test.js b/src/pages/Player/Player.test.js index 2ad4a8a..aed56cd 100644 --- a/src/pages/Player/Player.test.js +++ b/src/pages/Player/Player.test.js @@ -109,7 +109,20 @@ describe('', function () { const func = jest.fn(); - wrapper.setProps({history: {goBack: func}}); + wrapper.setProps({history: {push: func}}); + + expect(func).toHaveBeenCalledTimes(0); + wrapper.find('.closebutton').simulate('click'); + // there shouldn't be a backstack available + expect(func).toHaveBeenCalledTimes(1); + }); + + it('hide click with stack available', function () { + const wrapper = instance(); + + const func = jest.fn(); + + wrapper.setProps({history: {goBack: func, length: 5}}); expect(func).toHaveBeenCalledTimes(0); wrapper.find('.closebutton').simulate('click'); diff --git a/src/pages/Player/Player.tsx b/src/pages/Player/Player.tsx index c929d7e..ed4e27e 100644 --- a/src/pages/Player/Player.tsx +++ b/src/pages/Player/Player.tsx @@ -316,7 +316,7 @@ export class Player extends React.Component { closebtn(): void { const hist = this.props.history; if (hist.length > 1) { - this.props.history.goBack(); + hist.goBack(); } else { hist.push('/'); }