mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
Implement SuperChart and enable the chart plugins (#6154)
* setup plugin and add SuperChart * Integrate SuperChart into Chart.jsx * Add vizType as class name * Remove .slice_container * add snakeCase to sanitize class name * Remove old code to load charts * Fix supportedAnnotationTypes * Update AnnotationTypes, remove unnecessary imports and dependency from VIZ_TYPES * remove index.js and update unit test * resolve tree map issue * fix issue with annotation types * fix proptypes * add ) * address a few comments * create bound functions * bound more functions * add reselect * use reselect for chartprops * improve performance with reselect * remove unused props * Remove getFilters() and update table test * Remove unused code * Delete adaptors * switch to react-loadable * Rewrite with reloadable * Add timeout back * remove loading * update table unit test * remove pastDelay
This commit is contained in:
committed by
Chris Williams
parent
9580103c22
commit
5c02e3199b
@@ -1,81 +0,0 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import { chart as initChart } from '../../../src/chart/chartReducer';
|
||||
import Chart from '../../../src/chart/Chart';
|
||||
import ChartBody from '../../../src/chart/ChartBody';
|
||||
import Loading from '../../../src/components/Loading';
|
||||
|
||||
describe('Chart', () => {
|
||||
const chart = {
|
||||
...initChart,
|
||||
queryResponse: {
|
||||
form_data: {},
|
||||
error: null,
|
||||
status: 'success',
|
||||
},
|
||||
};
|
||||
const mockedProps = {
|
||||
...chart,
|
||||
id: 223,
|
||||
containerId: 'slice-container-223',
|
||||
datasource: {},
|
||||
formData: {},
|
||||
vizType: 'pie',
|
||||
height: 300,
|
||||
width: 400,
|
||||
actions: {
|
||||
runQuery: () => {},
|
||||
},
|
||||
};
|
||||
|
||||
let wrapper;
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(
|
||||
<Chart {...mockedProps} />,
|
||||
);
|
||||
});
|
||||
describe('renderVis', () => {
|
||||
let stub;
|
||||
beforeEach(() => {
|
||||
stub = sinon.stub(wrapper.instance(), 'renderVis');
|
||||
});
|
||||
afterEach(() => {
|
||||
stub.restore();
|
||||
});
|
||||
|
||||
it('should not call when loading', () => {
|
||||
const prevProp = wrapper.props();
|
||||
wrapper.setProps({
|
||||
height: 100,
|
||||
});
|
||||
wrapper.instance().componentDidUpdate(prevProp);
|
||||
expect(stub.callCount).toBe(0);
|
||||
});
|
||||
|
||||
it('should call after chart stop loading', () => {
|
||||
const prevProp = wrapper.props();
|
||||
wrapper.setProps({
|
||||
chartStatus: 'success',
|
||||
});
|
||||
wrapper.instance().componentDidUpdate(prevProp);
|
||||
expect(stub.callCount).toBe(1);
|
||||
});
|
||||
|
||||
it('should call after resize', () => {
|
||||
wrapper.setProps({
|
||||
chartStatus: 'rendered',
|
||||
height: 100,
|
||||
});
|
||||
expect(stub.callCount).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('render', () => {
|
||||
it('should render ChartBody after loading is completed', () => {
|
||||
expect(wrapper.find(Loading)).toHaveLength(1);
|
||||
expect(wrapper.find(ChartBody)).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user