nexshop-web-contents
Version:
Nexshop Web Contents Project
25 lines (21 loc) • 1.14 kB
JavaScript
import React from 'react';
import {expect} from 'chai';
import {shallow} from "enzyme";
import sinon from "sinon";
import SceneLayoutItemView from "../../../../src/component/scene/scene-resource/scene-layout-item-view";
describe('Scene Layout Item View Spec', () => {
let wrapper;
const spyChangeLayout = sinon.spy();
const orientationHorizontal = 'horizontal';
const orientationVertical = 'vertical';
it('render scene-layout--selected when layout id is selectedLayoutId', () => {
wrapper = shallow(<SceneLayoutItemView changeLayout={spyChangeLayout} orientation={orientationHorizontal} selectedLayoutId={'1'}/>);
let layoutWithId_1 = wrapper.find('.scene-layout-wrapper').at(0);
expect(layoutWithId_1.find('.scene-layout--selected').length).to.equal(1);
});
it('call changeLayout when item click ', () => {
wrapper = shallow(<SceneLayoutItemView changeLayout={spyChangeLayout} orientation={orientationVertical} selectedLayoutId={'1'}/>);
wrapper.find('.scene-layout-1-1').at(0).simulate('click');
expect(spyChangeLayout.calledWith('1')).to.be.true;
});
});