mirror of
https://github.com/apache/superset.git
synced 2026-04-13 05:07:53 +00:00
[exploreV2] mapStateToProps for fields (#1882)
* Controls support for mapStateToProps * Binding methods in the constructor * Adressing comments * Fixing tests
This commit is contained in:
committed by
GitHub
parent
9a62d94630
commit
222671675c
@@ -1,31 +1,18 @@
|
||||
import React from 'react';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it, beforeEach } from 'mocha';
|
||||
import { describe, it } from 'mocha';
|
||||
import { shallow } from 'enzyme';
|
||||
import { fields } from '../../../../javascripts/explorev2/stores/fields';
|
||||
import { defaultFormData } from '../../../../javascripts/explorev2/stores/store';
|
||||
import FieldSetRow from '../../../../javascripts/explorev2/components/FieldSetRow';
|
||||
import FieldSet from '../../../../javascripts/explorev2/components/FieldSet';
|
||||
|
||||
const defaultProps = {
|
||||
fields,
|
||||
fieldSets: ['columns', 'metrics'],
|
||||
form_data: defaultFormData(),
|
||||
};
|
||||
|
||||
describe('FieldSetRow', () => {
|
||||
let wrapper;
|
||||
|
||||
beforeEach(() => {
|
||||
wrapper = shallow(<FieldSetRow {...defaultProps} />);
|
||||
});
|
||||
|
||||
it('renders a single row element', () => {
|
||||
it('renders a single row with one element', () => {
|
||||
const wrapper = shallow(<FieldSetRow fields={[<a />]} />);
|
||||
expect(wrapper.find('.row')).to.have.lengthOf(1);
|
||||
expect(wrapper.find('.row').find('a')).to.have.lengthOf(1);
|
||||
});
|
||||
|
||||
it('renders a FieldSet for each item in fieldSets array', () => {
|
||||
const length = defaultProps.fieldSets.length;
|
||||
expect(wrapper.find(FieldSet)).to.have.lengthOf(length);
|
||||
it('renders a single row with two elements', () => {
|
||||
const wrapper = shallow(<FieldSetRow fields={[<a />, <a />]} />);
|
||||
expect(wrapper.find('.row')).to.have.lengthOf(1);
|
||||
expect(wrapper.find('.row').find('a')).to.have.lengthOf(2);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user