fix: shorten url with extra request parameters (#10693)

This commit is contained in:
Grace Guo
2020-08-27 09:53:20 -07:00
committed by GitHub
parent 19a9bcc9c5
commit 7fc227c92d
2 changed files with 17 additions and 14 deletions

View File

@@ -59,12 +59,12 @@ describe('EmbedCodeButton', () => {
wrapper.setState({
height: '1000',
width: '2000',
shortUrl: 'http://localhostendpoint_url&height=1000',
shortUrlId: 100,
});
const trigger = wrapper.find(OverlayTrigger);
trigger.simulate('click');
expect(spy1.args[0][1]).toBe('standalone');
expect(spy1.callCount).toBe(1);
expect(spy2.callCount).toBe(1);
spy1.restore();
@@ -72,11 +72,14 @@ describe('EmbedCodeButton', () => {
});
it('returns correct embed code', () => {
const stub = sinon
.stub(exploreUtils, 'getURIDirectory')
.callsFake(() => 'endpoint_url');
const wrapper = mount(<EmbedCodeButton {...defaultProps} />);
wrapper.setState({
height: '1000',
width: '2000',
shortUrl: 'http://localhostendpoint_url&height=1000',
shortUrlId: 100,
});
const embedHTML =
'<iframe\n' +
@@ -85,9 +88,10 @@ describe('EmbedCodeButton', () => {
' seamless\n' +
' frameBorder="0"\n' +
' scrolling="no"\n' +
' src="http://localhostendpoint_url&height=1000"\n' +
' src="http://localhostendpoint_url?r=100&standalone=true&height=1000"\n' +
'>\n' +
'</iframe>';
expect(wrapper.instance().generateEmbedHTML()).toBe(embedHTML);
stub.restore();
});
});