Skip to content

Commit

Permalink
More Dashboard UX unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Nov 15, 2016
1 parent 99b0d4c commit 5469840
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,4 +1,6 @@
*.pyc
yarn-error.log
_modules
superset/assets/coverage/*
changelog.sh
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion superset/assets/javascripts/dashboard/Dashboard.jsx
Expand Up @@ -74,7 +74,7 @@ function initDashboardView(dashboard) {
$('[data-toggle="tooltip"]').tooltip({ container: 'body' });
}

function dashboardContainer(dashboard) {
export function dashboardContainer(dashboard) {
return Object.assign({}, dashboard, {
type: 'dashboard',
filters: {},
Expand Down
6 changes: 0 additions & 6 deletions superset/assets/javascripts/dashboard/components/Controls.jsx
Expand Up @@ -10,14 +10,9 @@ import CodeModal from './CodeModal';
import SliceAdder from './SliceAdder';

const propTypes = {
table: React.PropTypes.object,
dashboard: React.PropTypes.object.isRequired,
};

const defaultProps = {
actions: {},
};

class Controls extends React.PureComponent {
constructor(props) {
super(props);
Expand Down Expand Up @@ -138,6 +133,5 @@ class Controls extends React.PureComponent {
}
}
Controls.propTypes = propTypes;
Controls.defaultProps = defaultProps;

export default Controls;
21 changes: 21 additions & 0 deletions superset/assets/spec/javascripts/dashboard/CodeModal_spec.jsx
@@ -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);
});
});
21 changes: 21 additions & 0 deletions superset/assets/spec/javascripts/dashboard/CssEditor_spec.jsx
@@ -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);
});
});

0 comments on commit 5469840

Please sign in to comment.