mirror of
https://github.com/apache/superset.git
synced 2026-04-09 11:25:23 +00:00
* Change in files * Renamin files and folders * cleaning up a single piece of lint * Removing boat picture from docs * add superset word mark * Update rename note in docs * Fixing images * Pinning datatables * Fixing issues with mapbox-gl * Forgot to rename one file * Linting * v0.13.0 * adding pyyaml to dev-reqs
44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
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
|
|
src="nullendpoint_url"
|
|
width="2000"
|
|
height="1000"
|
|
seamless frameBorder="0" scrolling="no">
|
|
</iframe>`;
|
|
expect(wrapper.instance().generateEmbedHTML()).to.equal(embedHTML);
|
|
});
|
|
});
|