1. fix check filters change logic (#4339)

2. should show chart after loading completed
This commit is contained in:
Grace Guo
2018-02-05 10:21:17 -08:00
committed by GitHub
parent ad212272d1
commit e965f95477
8 changed files with 177 additions and 27 deletions

View File

@@ -6,6 +6,8 @@ import sinon from 'sinon';
import { chart as initChart } from '../../../javascripts/chart/chartReducer';
import Chart from '../../../javascripts/chart/Chart';
import ChartBody from '../../../javascripts/chart/ChartBody';
import Loading from '../../../javascripts/components/Loading';
describe('Chart', () => {
const chart = {
@@ -30,15 +32,20 @@ describe('Chart', () => {
},
};
let wrapper;
beforeEach(() => {
wrapper = shallow(
<Chart {...mockedProps} />,
);
});
describe('renderViz', () => {
let wrapper;
let stub;
beforeEach(() => {
wrapper = shallow(
<Chart {...mockedProps} />,
);
stub = sinon.stub(wrapper.instance(), 'renderViz');
});
afterEach(() => {
stub.restore();
});
it('should not call when loading', () => {
const prevProp = wrapper.props();
@@ -68,4 +75,11 @@ describe('Chart', () => {
expect(stub.callCount).to.equals(1);
});
});
describe('render', () => {
it('should render ChartBody after loading is completed', () => {
expect(wrapper.find(Loading)).to.have.length(1);
expect(wrapper.find(ChartBody)).to.have.length(0);
});
});
});