Home Reference Source

application/__tests__/components/common/rich-editor/media-result-test.js

jest.unmock('./../../../../components/common/rich-editor/media-result');

import React from 'react';
import ReactDOM from 'react-dom';
import TestUtils from 'react-addons-test-utils';
import Immutable from 'immutable';
import sinon from 'sinon';
import AltTestingUtils from 'alt-utils/lib/AltTestingUtils';
import {GridTile} from 'material-ui/GridList';

import MediaResult from './../../../../components/common/rich-editor/media-result';

describe('MediaResultEditorComponent', () => {

    it('bubbles select media', () => {
        const content = Immutable.fromJS({attachment: {}});
        const clickSpy = sinon.stub();

        const el = TestUtils.renderIntoDocument(<MediaResult content={content} onSelectMedia={clickSpy} />);


        const div = TestUtils.findRenderedComponentWithType(el, GridTile);
        expect(div);
        el.onSelect();
        // TestUtils.Simulate.click(div, {});

        expect(clickSpy.called).toEqual(true);
        // el.onSelect.restore();
    });
});