Revert "[sql lab] Make sql editor resizable (#3242)" (#3360)

This reverts commit 75e69f02e8.
This commit is contained in:
Maxime Beauchemin
2017-08-23 14:40:08 -07:00
committed by GitHub
parent 0c36827368
commit 46d60880eb
10 changed files with 40 additions and 359 deletions

View File

@@ -1,66 +0,0 @@
import React from 'react';
import { shallow, mount } from 'enzyme';
import { describe, it } from 'mocha';
import { expect } from 'chai';
import sinon from 'sinon';
import SplitPane from '../../../javascripts/SqlLab/components/SplitPane';
function simulateWindowEvent(eventName, customProps) {
const evt = document.createEvent('Event');
evt.initEvent(eventName, true, true);
global.window.dispatchEvent(Object.assign(evt, customProps));
}
const TestComponent = () => (<div className="test" />);
describe('ResizableAceEditor', () => {
const mockedProps = {
north: () => <div className="stub north" />,
south: () => <div className="stub south" />,
};
let clock;
beforeEach(() => {
clock = sinon.useFakeTimers();
});
afterEach(() => {
clock.restore();
});
it('is valid', () => {
expect(
React.isValidElement(<SplitPane {...mockedProps} />),
).to.equal(true);
});
it('renders what you provide in north', () => {
const wrapper = shallow(<SplitPane {...mockedProps} north={<TestComponent />} />);
expect(wrapper.find(TestComponent)).to.have.length(1);
});
it('renders what you provide in south', () => {
const wrapper = shallow(<SplitPane {...mockedProps} south={<TestComponent />} />);
expect(wrapper.find(TestComponent)).to.have.length(1);
});
it('render a DragBar', () => {
const wrapper = shallow(<SplitPane {...mockedProps} />);
expect(wrapper.find('.DragBar')).to.have.length(1);
});
it('has dragging set to false by default', () => {
const wrapper = shallow(<SplitPane {...mockedProps} />);
expect(wrapper.state().dragging).to.be.equal(false);
});
it('has dragging set to true when dragged', () => {
const wrapper = shallow(<SplitPane {...mockedProps} />);
const dragbar = wrapper.find('.DragBar');
dragbar.simulate('mouseDown');
expect(wrapper.state().dragging).to.be.equal(true);
});
it('has dragging set to false when dropped', () => {
const wrapper = mount(<SplitPane {...mockedProps} />);
const dragbar = wrapper.find('.DragBar');
dragbar.simulate('mouseDown');
simulateWindowEvent('mouseup');
expect(wrapper.state().dragging).to.be.equal(false);
});
});

View File

@@ -6,7 +6,6 @@ import { expect } from 'chai';
import { initialState, queries, table } from './fixtures';
import SqlEditor from '../../../javascripts/SqlLab/components/SqlEditor';
import SqlEditorLeftBar from '../../../javascripts/SqlLab/components/SqlEditorLeftBar';
import SplitPane from '../../../javascripts/SqlLab/components/SplitPane';
describe('SqlEditor', () => {
const mockedProps = {
@@ -29,8 +28,4 @@ describe('SqlEditor', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(SqlEditorLeftBar)).to.have.length(1);
});
it('render a SplitPane', () => {
const wrapper = shallow(<SqlEditor {...mockedProps} />);
expect(wrapper.find(SplitPane)).to.have.length(1);
});
});