Skip to content

Commit

Permalink
update the example
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Jan 15, 2020
1 parent 594ff1e commit eae370e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion extensions/blocks/calendly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const settings = {
submitButtonText: __( 'Schedule time with me', 'jetpack' ),
hideEventTypeDetails: false,
style: 'inline',
url: 'https://calendly.com/scruffian/usability-test',
url: 'https://calendly.com/wordpresscom/jetpack-block-example',
},
},
};
36 changes: 18 additions & 18 deletions extensions/blocks/calendly/test/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,66 +8,66 @@
import { getAttributesFromEmbedCode } from '../utils';

const inlineEmbedCode = '<!-- Calendly inline widget begin -->' +
'<div class="calendly-inline-widget" data-url="https://calendly.com/scruffian/usability-test" style="min-width:320px;height:630px;"></div>' +
'<div class="calendly-inline-widget" data-url="https://calendly.com/wordpresscom/jetpack-block-example" style="min-width:320px;height:630px;"></div>' +
'<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>' +
'<!-- Calendly inline widget end -->';

const widgetEmbedCode = '<!-- Calendly badge widget begin -->' +
'<link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet">' +
'<script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript"></script>' +
'<script type="text/javascript">Calendly.initBadgeWidget({ url: \'https://calendly.com/scruffian/usability-test\', text: \'Schedule time with me\', color: \'#00a2ff\', textColor: \'#ffffff\', branding: true });</script>' +
'<script type="text/javascript">Calendly.initBadgeWidget({ url: \'https://calendly.com/wordpresscom/jetpack-block-example\', text: \'Schedule time with me\', color: \'#00a2ff\', textColor: \'#ffffff\', branding: true });</script>' +
'<!-- Calendly badge widget end -->';

const textEmbedCode = '<!-- Calendly link widget begin -->' +
'<link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet">' +
'<script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript"></script>' +
'<a href="" onclick="Calendly.initPopupWidget({url: \'https://calendly.com/scruffian/usability-test\'});return false;">Schedule time with me</a>' +
'<a href="" onclick="Calendly.initPopupWidget({url: \'https://calendly.com/wordpresscom/jetpack-block-example\'});return false;">Schedule time with me</a>' +
'<!-- Calendly link widget end -->';

const customInlineEmbedCode = '<!-- Calendly inline widget begin -->' +
'<div class="calendly-inline-widget" data-url="https://calendly.com/scruffian/usability-test?hide_event_type_details=1&background_color=691414&text_color=2051a3&primary_color=1d6e9c" style="min-width:320px;height:630px;"></div>' +
'<div class="calendly-inline-widget" data-url="https://calendly.com/wordpresscom/jetpack-block-example?hide_event_type_details=1&background_color=691414&text_color=2051a3&primary_color=1d6e9c" style="min-width:320px;height:630px;"></div>' +
'<script type="text/javascript" src="https://assets.calendly.com/assets/external/widget.js"></script>' +
'<!-- Calendly inline widget end -->';

const customWidgetEmbedCode = '<!-- Calendly badge widget begin -->' +
'<link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet">' +
'<script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript"></script>' +
'<script type="text/javascript">Calendly.initBadgeWidget({ url: \'https://calendly.com/scruffian/usability-test?background_color=c51414&text_color=2563ca&primary_color=1d73a4\', text: \'Schedule some time with me\', color: \'#000609\', textColor: \'#b50000\', branding: true });</script>' +
'<script type="text/javascript">Calendly.initBadgeWidget({ url: \'https://calendly.com/wordpresscom/jetpack-block-example?background_color=c51414&text_color=2563ca&primary_color=1d73a4\', text: \'Schedule some time with me\', color: \'#000609\', textColor: \'#b50000\', branding: true });</script>' +
'<!-- Calendly badge widget end -->';

const customTextEmbedCode = '<!-- Calendly link widget begin -->' +
'<link href="https://assets.calendly.com/assets/external/widget.css" rel="stylesheet">' +
'<script src="https://assets.calendly.com/assets/external/widget.js" type="text/javascript"></script>' +
'<a href="" onclick="Calendly.initPopupWidget({url: \'https://calendly.com/scruffian/usability-test?background_color=e32424&text_color=2a74ef&primary_color=0e425f\'});return false;">Schedule some time with me</a>' +
'<a href="" onclick="Calendly.initPopupWidget({url: \'https://calendly.com/wordpresscom/jetpack-block-example?background_color=e32424&text_color=2a74ef&primary_color=0e425f\'});return false;">Schedule some time with me</a>' +
'<!-- Calendly link widget end -->';

describe( 'getAttributesFromEmbedCode', () => {
test( 'URL with http', () => {
expect(
getAttributesFromEmbedCode( 'https://calendly.com/scruffian/usability-test' )
getAttributesFromEmbedCode( 'https://calendly.com/wordpresscom/jetpack-block-example' )
).toEqual(
{
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );

test( 'URL without http', () => {
expect(
getAttributesFromEmbedCode( 'calendly.com/scruffian/usability-test' )
getAttributesFromEmbedCode( 'calendly.com/wordpresscom/jetpack-block-example' )
).toEqual(
{
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );

test( 'URL with query string', () => {
expect(
getAttributesFromEmbedCode( '//calendly.com/scruffian/usability-test?month=2019-12' )
getAttributesFromEmbedCode( '//calendly.com/wordpresscom/jetpack-block-example?month=2020-01' )
).toEqual(
{
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );
Expand All @@ -78,7 +78,7 @@ describe( 'getAttributesFromEmbedCode', () => {
).toEqual(
{
"style": "inline",
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );
Expand All @@ -92,7 +92,7 @@ describe( 'getAttributesFromEmbedCode', () => {
"submitButtonText": "Schedule time with me",
"customBackgroundButtonColor": "#00a2ff",
"customTextButtonColor": "#ffffff",
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );
Expand All @@ -104,7 +104,7 @@ describe( 'getAttributesFromEmbedCode', () => {
{
"style": "link",
"submitButtonText": "Schedule time with me",
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );
Expand All @@ -119,7 +119,7 @@ describe( 'getAttributesFromEmbedCode', () => {
"primaryColor": "1d6e9c",
"style": "inline",
"textColor": "2051a3",
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );
Expand All @@ -136,7 +136,7 @@ describe( 'getAttributesFromEmbedCode', () => {
"style": "link",
"submitButtonText": "Schedule some time with me",
"textColor": "2563ca",
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} );
Expand All @@ -151,7 +151,7 @@ describe( 'getAttributesFromEmbedCode', () => {
"style": "link",
"submitButtonText": "Schedule some time with me",
"textColor": "2a74ef",
"url": "https://calendly.com/scruffian/usability-test"
"url": "https://calendly.com/wordpresscom/jetpack-block-example"
}
);
} )
Expand Down

0 comments on commit eae370e

Please sign in to comment.