mirror of https://github.com/apache/superset.git
More Dashboard UX unit tests (#1603)
This commit is contained in:
parent
4f7f437527
commit
c362f2869e
|
@ -1,4 +1,6 @@
|
||||||
*.pyc
|
*.pyc
|
||||||
|
yarn-error.log
|
||||||
|
_modules
|
||||||
superset/assets/coverage/*
|
superset/assets/coverage/*
|
||||||
changelog.sh
|
changelog.sh
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
|
@ -74,7 +74,7 @@ function initDashboardView(dashboard) {
|
||||||
$('[data-toggle="tooltip"]').tooltip({ container: 'body' });
|
$('[data-toggle="tooltip"]').tooltip({ container: 'body' });
|
||||||
}
|
}
|
||||||
|
|
||||||
function dashboardContainer(dashboard) {
|
export function dashboardContainer(dashboard) {
|
||||||
return Object.assign({}, dashboard, {
|
return Object.assign({}, dashboard, {
|
||||||
type: 'dashboard',
|
type: 'dashboard',
|
||||||
filters: {},
|
filters: {},
|
||||||
|
|
|
@ -10,14 +10,9 @@ import CodeModal from './CodeModal';
|
||||||
import SliceAdder from './SliceAdder';
|
import SliceAdder from './SliceAdder';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
table: React.PropTypes.object,
|
|
||||||
dashboard: React.PropTypes.object.isRequired,
|
dashboard: React.PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultProps = {
|
|
||||||
actions: {},
|
|
||||||
};
|
|
||||||
|
|
||||||
class Controls extends React.PureComponent {
|
class Controls extends React.PureComponent {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
@ -138,6 +133,5 @@ class Controls extends React.PureComponent {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controls.propTypes = propTypes;
|
Controls.propTypes = propTypes;
|
||||||
Controls.defaultProps = defaultProps;
|
|
||||||
|
|
||||||
export default Controls;
|
export default Controls;
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React from 'react';
|
||||||
|
import CodeModal from '../../../javascripts/dashboard/components/CodeModal';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
import { describe, it } from 'mocha';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
|
||||||
|
|
||||||
|
describe('CodeModal', () => {
|
||||||
|
const mockedProps = {
|
||||||
|
triggerNode: <i className="fa fa-edit" />,
|
||||||
|
};
|
||||||
|
it('is valid', () => {
|
||||||
|
expect(
|
||||||
|
React.isValidElement(<CodeModal {...mockedProps} />)
|
||||||
|
).to.equal(true);
|
||||||
|
});
|
||||||
|
it('renders the trigger node', () => {
|
||||||
|
const wrapper = mount(<CodeModal {...mockedProps} />);
|
||||||
|
expect(wrapper.find('.fa-edit')).to.have.length(1);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React from 'react';
|
||||||
|
import CssEditor from '../../../javascripts/dashboard/components/CssEditor';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
import { describe, it } from 'mocha';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
|
||||||
|
|
||||||
|
describe('CssEditor', () => {
|
||||||
|
const mockedProps = {
|
||||||
|
triggerNode: <i className="fa fa-edit" />,
|
||||||
|
};
|
||||||
|
it('is valid', () => {
|
||||||
|
expect(
|
||||||
|
React.isValidElement(<CssEditor {...mockedProps} />)
|
||||||
|
).to.equal(true);
|
||||||
|
});
|
||||||
|
it('renders the trigger node', () => {
|
||||||
|
const wrapper = mount(<CssEditor {...mockedProps} />);
|
||||||
|
expect(wrapper.find('.fa-edit')).to.have.length(1);
|
||||||
|
});
|
||||||
|
});
|
|
@ -0,0 +1,21 @@
|
||||||
|
import React from 'react';
|
||||||
|
import RefreshIntervalModal from '../../../javascripts/dashboard/components/RefreshIntervalModal';
|
||||||
|
import { mount } from 'enzyme';
|
||||||
|
import { describe, it } from 'mocha';
|
||||||
|
import { expect } from 'chai';
|
||||||
|
|
||||||
|
|
||||||
|
describe('RefreshIntervalModal', () => {
|
||||||
|
const mockedProps = {
|
||||||
|
triggerNode: <i className="fa fa-edit" />,
|
||||||
|
};
|
||||||
|
it('is valid', () => {
|
||||||
|
expect(
|
||||||
|
React.isValidElement(<RefreshIntervalModal {...mockedProps} />)
|
||||||
|
).to.equal(true);
|
||||||
|
});
|
||||||
|
it('renders the trigger node', () => {
|
||||||
|
const wrapper = mount(<RefreshIntervalModal {...mockedProps} />);
|
||||||
|
expect(wrapper.find('.fa-edit')).to.have.length(1);
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue