added tests for PageTitle component
repaired failing homepage test
This commit is contained in:
		@@ -14,7 +14,9 @@ class PageTitle extends React.Component {
 | 
			
		||||
            <div className='pageheader'>
 | 
			
		||||
                <span className='pageheadertitle'>{this.props.title}</span>
 | 
			
		||||
                <span className='pageheadersubtitle'>{this.props.subtitle}</span>
 | 
			
		||||
                {this.props.children}
 | 
			
		||||
                <>
 | 
			
		||||
                    {this.props.children}
 | 
			
		||||
                </>
 | 
			
		||||
                <hr/>
 | 
			
		||||
            </div>
 | 
			
		||||
        );
 | 
			
		||||
 
 | 
			
		||||
@@ -8,5 +8,24 @@ describe('<Preview/>', function () {
 | 
			
		||||
        const wrapper = shallow(<PageTitle/>);
 | 
			
		||||
        wrapper.unmount();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('renders childs correctly', function () {
 | 
			
		||||
        const wrapper = shallow(<PageTitle>heyimachild</PageTitle>);
 | 
			
		||||
 | 
			
		||||
        const children = wrapper.children();
 | 
			
		||||
        expect(children.at(children.length-2).text()).toBe("heyimachild");
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('renders pagetitle prop', function () {
 | 
			
		||||
        const wrapper = shallow(<PageTitle title='testtitle'/>);
 | 
			
		||||
 | 
			
		||||
        expect(wrapper.find(".pageheader").text()).toBe("testtitle");
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('renders subtitle prop', function () {
 | 
			
		||||
        const wrapper = shallow(<PageTitle subtitle='testsubtitle'/>);
 | 
			
		||||
 | 
			
		||||
        expect(wrapper.find(".pageheadersubtitle").text()).toBe("testsubtitle");
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -52,14 +52,14 @@ describe('<HomePage/>', function () {
 | 
			
		||||
    it('test title and nr insertions', function () {
 | 
			
		||||
        const wrapper = shallow(<HomePage/>);
 | 
			
		||||
 | 
			
		||||
        expect(wrapper.find(".pageheadersubtitle").text()).toBe("All Videos - 0");
 | 
			
		||||
        expect(wrapper.find("PageTitle").props().subtitle).toBe("All Videos - 0");
 | 
			
		||||
 | 
			
		||||
        wrapper.setState({
 | 
			
		||||
            tag: "testtag",
 | 
			
		||||
            selectionnr: 42
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        expect(wrapper.find(".pageheadersubtitle").text()).toBe("testtag Videos - 42");
 | 
			
		||||
        expect(wrapper.find("PageTitle").props().subtitle).toBe("testtag Videos - 42");
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('test search field', done => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user