Skip to content

Commit

Permalink
test: add twitter to services test
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Jan 27, 2022
1 parent eeccb43 commit 774ec25
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 20 deletions.
55 changes: 38 additions & 17 deletions tests/benchmarks/services/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,41 @@ <h1>Services Benchmark</h1>
</script>
</template>

<template id="hs">
<script>
(function () {
console.log('Hubspot');
var output = document.getElementById('output');

var hsScript = document.createElement('script');
hsScript.async = true;
hsScript.defer = true;
hsScript.id = 'hs-script-loader';
hsScript.src = '//js.hs-scripts.com/20632911.js';
output.appendChild(hsScript);
})();
</script>
</template>

<template id="twitter">
<script>
(function () {
console.log('Twitter');
var output = document.getElementById('output');

var twitterBlockquote = document.createElement('blockquote');
twitterBlockquote.className = 'twitter-tweet';
twitterBlockquote.innerHTML = `<p lang="en" dir="ltr">How <a href="https://twitter.com/builderio?ref_src=twsrc%5Etfw">@builderio</a> cut 99% of their JavaScript with <a href="https://twitter.com/QwikDev?ref_src=twsrc%5Etfw">@QwikDev</a> + Partytown<a href="https://t.co/VhdljVdqrZ">https://t.co/VhdljVdqrZ</a> <a href="https://t.co/vb9VLu7vbJ">https://t.co/vb9VLu7vbJ</a></p>&mdash; Qwik WebDev Framework (@QwikDev) <a href="https://twitter.com/QwikDev/status/1468672275775950854?ref_src=twsrc%5Etfw">December 8, 2021</a>`;
output.appendChild(twitterBlockquote);

var twitterScript = document.createElement('script');
twitterScript.async = true;
twitterScript.src = 'https://platform.twitter.com/widgets.js';
output.appendChild(twitterScript);
})();
</script>
</template>

<template id="wistia">
<script>
(function () {
Expand All @@ -158,22 +193,6 @@ <h1>Services Benchmark</h1>
</script>
</template>

<template id="hs">
<script>
(function () {
console.log('Hubspot');
var output = document.getElementById('output');

var hsScript = document.createElement('script');
hsScript.async = true;
hsScript.defer = true;
hsScript.id = 'hs-script-loader';
hsScript.src = '//js.hs-scripts.com/20632911.js';
output.appendChild(hsScript);
})();
</script>
</template>

<template id="partytown">
<script>
partytown = {
Expand All @@ -183,7 +202,8 @@ <h1>Services Benchmark</h1>
url.hostname.includes('www.googletagmanager.com') ||
url.hostname.includes('connect.facebook.net') ||
url.hostname.includes('js.hs-scripts.com') ||
url.hostname.includes('js.hs-analytics.net')
url.hostname.includes('js.hs-analytics.net') ||
url.hostname.includes('cdn.syndication.twimg.com')
) {
const proxyUrl = new URL('https://cdn.builder.io/api/v1/proxy-api');
proxyUrl.searchParams.append('url', url);
Expand Down Expand Up @@ -250,6 +270,7 @@ <h1>Services Benchmark</h1>
{ name: 'Facebook Pixel', id: 'fbp' },
{ name: 'Google Tag Manager', id: 'gtm' },
{ name: 'Hubspot', id: 'hs' },
{ name: 'Twitter', id: 'twitter' },
{ name: 'Wistia', id: 'wistia' },
];

Expand Down
5 changes: 2 additions & 3 deletions tests/integrations/twitter/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ <h1>Partytown Twitter Embed 🎉</h1>

<!-- prettier-ignore -->
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">How <a href="https://twitter.com/builderio?ref_src=twsrc%5Etfw">@builderio</a> cut 99% of their JavaScript with <a href="https://twitter.com/QwikDev?ref_src=twsrc%5Etfw">@QwikDev</a> + Partytown<a href="https://t.co/VhdljVdqrZ">https://t.co/VhdljVdqrZ</a> <a href="https://t.co/vb9VLu7vbJ">https://t.co/vb9VLu7vbJ</a></p>&mdash; Qwik WebDev Framework (@QwikDev) <a href="https://twitter.com/QwikDev/status/1468672275775950854?ref_src=twsrc%5Etfw">December 8, 2021</a></blockquote>
<!-- <script
<script
async
src="https://platform.twitter.com/widgets.js"
charset="utf-8"
type="text/partytown"
></script> -->
<script async src="widgets.js" charset="utf-8" type="text/partytown"></script>
></script>

<hr />
<nav>
Expand Down

1 comment on commit 774ec25

@vercel
Copy link

@vercel vercel bot commented on 774ec25 Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.