mirror of
https://github.com/apache/superset.git
synced 2026-04-09 11:25:23 +00:00
[js-testing] more tests for SelectControl (#2877)
* rename spec folder * remove special handling for viz_type control since it now uses VizTypeControl * add test for getOptions * linting * add test for cwp * linting
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import React from 'react';
|
||||
import { expect } from 'chai';
|
||||
import { describe, it } from 'mocha';
|
||||
import { shallow, mount } from 'enzyme';
|
||||
import { OverlayTrigger } from 'react-bootstrap';
|
||||
|
||||
import EmbedCodeButton from '../../../../javascripts/explore/components/EmbedCodeButton';
|
||||
|
||||
describe('EmbedCodeButton', () => {
|
||||
const defaultProps = {
|
||||
slice: {
|
||||
data: {
|
||||
standalone_endpoint: 'endpoint_url',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
it('renders', () => {
|
||||
expect(React.isValidElement(<EmbedCodeButton {...defaultProps} />)).to.equal(true);
|
||||
});
|
||||
|
||||
it('renders overlay trigger', () => {
|
||||
const wrapper = shallow(<EmbedCodeButton {...defaultProps} />);
|
||||
expect(wrapper.find(OverlayTrigger)).to.have.length(1);
|
||||
});
|
||||
|
||||
it('returns correct embed code', () => {
|
||||
const wrapper = mount(<EmbedCodeButton {...defaultProps} />);
|
||||
wrapper.setState({
|
||||
height: '1000',
|
||||
width: '2000',
|
||||
srcLink: 'http://localhost/endpoint_url',
|
||||
});
|
||||
const embedHTML = (
|
||||
'<iframe\n' +
|
||||
' width="2000"\n' +
|
||||
' height="1000"\n' +
|
||||
' seamless\n' +
|
||||
' frameBorder="0"\n' +
|
||||
' scrolling="no"\n' +
|
||||
' src="nullendpoint_url&height=1000"\n' +
|
||||
'>\n' +
|
||||
'</iframe>'
|
||||
);
|
||||
expect(wrapper.instance().generateEmbedHTML()).to.equal(embedHTML);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user