import { shallow, mount } from 'enzyme';
import React from 'react';
import { NavbarUserButton } from 'web-foundation';

describe('<Navbar />', function() {
    it('should initialize all nice like', function() {
        const wrapper = mount(
            <NavbarUserButton />
        );

        expect(wrapper.type()).to.equal(NavbarUserButton);
    });

    it('should have component class name', function() {
        const wrapper = shallow(<NavbarUserButton />);

        expect(wrapper.hasClass('navbar-user-button')).to.be.true;
    });

    it('should show children only when state is set to open', function() {
        const text = '<NavbarButton />Items',
            wrapper = shallow(
                <NavbarUserButton>
                    Items
                </NavbarUserButton>);

        expect(wrapper.text()).to.not.equal(text);

        wrapper.setState({ open: true });

        expect(wrapper.text()).to.equal(text);

        wrapper.instance().close();
        wrapper.update();

        expect(wrapper.text()).to.not.equal(text);
    });
});
