mirror of
https://github.com/apache/superset.git
synced 2026-04-20 08:34:37 +00:00
[dashboard] adding an option to duplicate slices when "Saving AS" (#3391)
* [dashboard] adding an option to duplicate slices when "Saving AS" * Fix tests
This commit is contained in:
committed by
GitHub
parent
3b4cd812ae
commit
e53f3032bb
@@ -0,0 +1,39 @@
|
||||
import React from 'react';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it } from 'mocha';
|
||||
import sinon from 'sinon';
|
||||
import { shallow } from 'enzyme';
|
||||
|
||||
import Checkbox from '../../../javascripts/components/Checkbox';
|
||||
|
||||
describe('Checkbox', () => {
|
||||
const defaultProps = {
|
||||
checked: true,
|
||||
onChange: sinon.spy(),
|
||||
};
|
||||
|
||||
let wrapper;
|
||||
const factory = (o) => {
|
||||
const props = Object.assign({}, defaultProps, o);
|
||||
return shallow(<Checkbox {...props} />);
|
||||
};
|
||||
beforeEach(() => {
|
||||
wrapper = factory({});
|
||||
});
|
||||
it('is a valid element', () => {
|
||||
expect(React.isValidElement(<Checkbox {...defaultProps} />)).to.equal(true);
|
||||
});
|
||||
it('inits checked when checked', () => {
|
||||
expect(wrapper.find('i.fa-check.text-primary')).to.have.length(1);
|
||||
});
|
||||
it('inits unchecked when not checked', () => {
|
||||
const el = factory({ checked: false });
|
||||
expect(el.find('i.fa-check.text-primary')).to.have.length(0);
|
||||
expect(el.find('i.fa-check.text-transparent')).to.have.length(1);
|
||||
});
|
||||
it('unchecks when clicked', () => {
|
||||
expect(wrapper.find('i.fa-check.text-transparent')).to.have.length(0);
|
||||
wrapper.find('i').first().simulate('click');
|
||||
expect(defaultProps.onChange.calledOnce).to.equal(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user