Sha256: 632a794816280ce38dbe93461278e814585ef47f91d4603ae304a6578bd525c2

Contents?: true

Size: 1.22 KB

Versions: 5

Compression:

Stored size: 1.22 KB

Contents

import React from 'react';
import { each, range } from 'lodash';

import Tabs, { ScreenTab } from 'hippo/workspace/tabs';
import Instance    from 'hippo/screens/instance';

import { getTestScreen } from '../test-models';
import { Context, Snapshot } from 'hippo/testing/screens';

const addTab = () =>
    new Instance({ definition: getTestScreen() });

describe('Workspace Navbar', () => {
    beforeEach(() => {
        each(range(0, 3), addTab);
    });

    it('renders and adds/removes tabs', () => {
        const options = new Context();
        const tabs = shallow(<Tabs />, options);
        expect(tabs.find('ScreenTab').length).toEqual(3);
        addTab();
        expect(tabs.find('ScreenTab').length).toEqual(4);
        Instance.displaying[2].remove();
        expect(tabs.find('ScreenTab').length).toEqual(3);
        expect(Snapshot(<Tabs />)).toMatchSnapshot();
    });

    it('renders a tab', () => {
        const options = new Context();
        const screen = Instance.displaying[2];
        const tab = shallow(<ScreenTab screen={screen} />, options);
        expect(tab).toHaveRendered(`Tab[title="${screen.title}"]`);
        expect(Snapshot(<ScreenTab screen={Instance.displaying[2]} />)).toMatchSnapshot();
    });
});

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hippo-fw-0.9.5 spec/client/screens/tabs.spec.jsx
hippo-fw-0.9.4 spec/client/screens/tabs.spec.jsx
hippo-fw-0.9.3 spec/client/screens/tabs.spec.jsx
hippo-fw-0.9.2 spec/client/screens/tabs.spec.jsx
hippo-fw-0.9.1 spec/client/screens/tabs.spec.jsx