mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added breaking test for ghost_head including portal script
refs https://linear.app/ghost/issue/ONC-254 refs https://github.com/TryGhost/Ghost/issues/20771 The reason that recommendations aren't working is because portal isn't loaded, which handles the data-attributes having the event listeners added to them.
This commit is contained in:
parent
df1da8ac24
commit
0cb435fe4d
2 changed files with 250 additions and 0 deletions
|
@ -1201,6 +1201,119 @@ Object {
|
|||
}
|
||||
`;
|
||||
|
||||
exports[`{{ghost_head}} helper members scripts includes portal when donations enabled 1 1`] = `
|
||||
Object {
|
||||
"rendered": "<meta name=\\"description\\" content=\\"site description\\">
|
||||
<link rel=\\"canonical\\" href=\\"http://127.0.0.1:2369/\\">
|
||||
<meta name=\\"referrer\\" content=\\"no-referrer-when-downgrade\\">
|
||||
|
||||
<meta property=\\"og:site_name\\" content=\\"Ghost\\">
|
||||
<meta property=\\"og:type\\" content=\\"website\\">
|
||||
<meta property=\\"og:title\\" content=\\"Ghost\\">
|
||||
<meta property=\\"og:description\\" content=\\"site description\\">
|
||||
<meta property=\\"og:url\\" content=\\"http://127.0.0.1:2369/\\">
|
||||
<meta property=\\"og:image\\" content=\\"http://127.0.0.1:2369/content/images/site-cover.png\\">
|
||||
<meta name=\\"twitter:card\\" content=\\"summary_large_image\\">
|
||||
<meta name=\\"twitter:title\\" content=\\"Ghost\\">
|
||||
<meta name=\\"twitter:description\\" content=\\"site description\\">
|
||||
<meta name=\\"twitter:url\\" content=\\"http://127.0.0.1:2369/\\">
|
||||
<meta name=\\"twitter:image\\" content=\\"http://127.0.0.1:2369/content/images/site-cover.png\\">
|
||||
|
||||
<script type=\\"application/ld+json\\">
|
||||
{
|
||||
\\"@context\\": \\"https://schema.org\\",
|
||||
\\"@type\\": \\"WebSite\\",
|
||||
\\"publisher\\": {
|
||||
\\"@type\\": \\"Organization\\",
|
||||
\\"name\\": \\"Ghost\\",
|
||||
\\"url\\": \\"http://127.0.0.1:2369/\\",
|
||||
\\"logo\\": {
|
||||
\\"@type\\": \\"ImageObject\\",
|
||||
\\"url\\": \\"http://127.0.0.1:2369/favicon.ico\\"
|
||||
}
|
||||
},
|
||||
\\"url\\": \\"http://127.0.0.1:2369/\\",
|
||||
\\"image\\": {
|
||||
\\"@type\\": \\"ImageObject\\",
|
||||
\\"url\\": \\"http://127.0.0.1:2369/content/images/site-cover.png\\"
|
||||
},
|
||||
\\"mainEntityOfPage\\": \\"http://127.0.0.1:2369/\\",
|
||||
\\"description\\": \\"site description\\"
|
||||
}
|
||||
</script>
|
||||
|
||||
<meta name=\\"generator\\" content=\\"Ghost 4.3\\">
|
||||
<link rel=\\"alternate\\" type=\\"application/rss+xml\\" title=\\"Ghost\\" href=\\"http://localhost:65530/rss/\\">
|
||||
<script defer src=\\"https://cdn.jsdelivr.net/ghost/portal@~[[VERSION]]/umd/portal.min.js\\" data-i18n=\\"false\\" data-ghost=\\"http://127.0.0.1:2369/\\" data-key=\\"xyz\\" data-api=\\"http://127.0.0.1:2369/ghost/api/content/\\" crossorigin=\\"anonymous\\"></script><style id=\\"gh-members-styles\\">.gh-post-upgrade-cta-content,
|
||||
.gh-post-upgrade-cta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
color: #ffffff;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta-content {
|
||||
border-radius: 8px;
|
||||
padding: 40px 4vw;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta h2 {
|
||||
color: #ffffff;
|
||||
font-size: 28px;
|
||||
letter-spacing: -0.2px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta p {
|
||||
margin: 20px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta small {
|
||||
font-size: 16px;
|
||||
letter-spacing: -0.2px;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a {
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
box-shadow: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a:hover {
|
||||
color: #ffffff;
|
||||
opacity: 0.8;
|
||||
box-shadow: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a.gh-btn {
|
||||
display: block;
|
||||
background: #ffffff;
|
||||
text-decoration: none;
|
||||
margin: 28px 0 0;
|
||||
padding: 8px 18px;
|
||||
border-radius: 4px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a.gh-btn:hover {
|
||||
opacity: 0.92;
|
||||
}</style>
|
||||
<script defer src=\\"https://cdn.jsdelivr.net/ghost/sodo-search@~[[VERSION]]/umd/sodo-search.min.js\\" data-key=\\"xyz\\" data-styles=\\"https://cdn.jsdelivr.net/ghost/sodo-search@~[[VERSION]]/umd/main.css\\" data-sodo-search=\\"http://127.0.0.1:2369/\\" data-locale=\\"en\\" crossorigin=\\"anonymous\\"></script>
|
||||
|
||||
<link href=\\"http://127.0.0.1:2369/webmentions/receive/\\" rel=\\"webmention\\">",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`{{ghost_head}} helper members scripts includes portal when members enabled 1 1`] = `
|
||||
Object {
|
||||
"rendered": "<meta name=\\"description\\" content=\\"site description\\">
|
||||
|
@ -1315,6 +1428,119 @@ Object {
|
|||
}
|
||||
`;
|
||||
|
||||
exports[`{{ghost_head}} helper members scripts includes portal when recommendations enabled 1 1`] = `
|
||||
Object {
|
||||
"rendered": "<meta name=\\"description\\" content=\\"site description\\">
|
||||
<link rel=\\"canonical\\" href=\\"http://127.0.0.1:2369/\\">
|
||||
<meta name=\\"referrer\\" content=\\"no-referrer-when-downgrade\\">
|
||||
|
||||
<meta property=\\"og:site_name\\" content=\\"Ghost\\">
|
||||
<meta property=\\"og:type\\" content=\\"website\\">
|
||||
<meta property=\\"og:title\\" content=\\"Ghost\\">
|
||||
<meta property=\\"og:description\\" content=\\"site description\\">
|
||||
<meta property=\\"og:url\\" content=\\"http://127.0.0.1:2369/\\">
|
||||
<meta property=\\"og:image\\" content=\\"http://127.0.0.1:2369/content/images/site-cover.png\\">
|
||||
<meta name=\\"twitter:card\\" content=\\"summary_large_image\\">
|
||||
<meta name=\\"twitter:title\\" content=\\"Ghost\\">
|
||||
<meta name=\\"twitter:description\\" content=\\"site description\\">
|
||||
<meta name=\\"twitter:url\\" content=\\"http://127.0.0.1:2369/\\">
|
||||
<meta name=\\"twitter:image\\" content=\\"http://127.0.0.1:2369/content/images/site-cover.png\\">
|
||||
|
||||
<script type=\\"application/ld+json\\">
|
||||
{
|
||||
\\"@context\\": \\"https://schema.org\\",
|
||||
\\"@type\\": \\"WebSite\\",
|
||||
\\"publisher\\": {
|
||||
\\"@type\\": \\"Organization\\",
|
||||
\\"name\\": \\"Ghost\\",
|
||||
\\"url\\": \\"http://127.0.0.1:2369/\\",
|
||||
\\"logo\\": {
|
||||
\\"@type\\": \\"ImageObject\\",
|
||||
\\"url\\": \\"http://127.0.0.1:2369/favicon.ico\\"
|
||||
}
|
||||
},
|
||||
\\"url\\": \\"http://127.0.0.1:2369/\\",
|
||||
\\"image\\": {
|
||||
\\"@type\\": \\"ImageObject\\",
|
||||
\\"url\\": \\"http://127.0.0.1:2369/content/images/site-cover.png\\"
|
||||
},
|
||||
\\"mainEntityOfPage\\": \\"http://127.0.0.1:2369/\\",
|
||||
\\"description\\": \\"site description\\"
|
||||
}
|
||||
</script>
|
||||
|
||||
<meta name=\\"generator\\" content=\\"Ghost 4.3\\">
|
||||
<link rel=\\"alternate\\" type=\\"application/rss+xml\\" title=\\"Ghost\\" href=\\"http://localhost:65530/rss/\\">
|
||||
<script defer src=\\"https://cdn.jsdelivr.net/ghost/portal@~[[VERSION]]/umd/portal.min.js\\" data-i18n=\\"false\\" data-ghost=\\"http://127.0.0.1:2369/\\" data-key=\\"xyz\\" data-api=\\"http://127.0.0.1:2369/ghost/api/content/\\" crossorigin=\\"anonymous\\"></script><style id=\\"gh-members-styles\\">.gh-post-upgrade-cta-content,
|
||||
.gh-post-upgrade-cta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
color: #ffffff;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta-content {
|
||||
border-radius: 8px;
|
||||
padding: 40px 4vw;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta h2 {
|
||||
color: #ffffff;
|
||||
font-size: 28px;
|
||||
letter-spacing: -0.2px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta p {
|
||||
margin: 20px 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta small {
|
||||
font-size: 16px;
|
||||
letter-spacing: -0.2px;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a {
|
||||
color: #ffffff;
|
||||
cursor: pointer;
|
||||
font-weight: 500;
|
||||
box-shadow: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a:hover {
|
||||
color: #ffffff;
|
||||
opacity: 0.8;
|
||||
box-shadow: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a.gh-btn {
|
||||
display: block;
|
||||
background: #ffffff;
|
||||
text-decoration: none;
|
||||
margin: 28px 0 0;
|
||||
padding: 8px 18px;
|
||||
border-radius: 4px;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.gh-post-upgrade-cta a.gh-btn:hover {
|
||||
opacity: 0.92;
|
||||
}</style>
|
||||
<script defer src=\\"https://cdn.jsdelivr.net/ghost/sodo-search@~[[VERSION]]/umd/sodo-search.min.js\\" data-key=\\"xyz\\" data-styles=\\"https://cdn.jsdelivr.net/ghost/sodo-search@~[[VERSION]]/umd/main.css\\" data-sodo-search=\\"http://127.0.0.1:2369/\\" data-locale=\\"en\\" crossorigin=\\"anonymous\\"></script>
|
||||
|
||||
<link href=\\"http://127.0.0.1:2369/webmentions/receive/\\" rel=\\"webmention\\">",
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`{{ghost_head}} helper members scripts includes stripe when connected 1 1`] = `
|
||||
Object {
|
||||
"rendered": "<meta name=\\"description\\" content=\\"site description\\">
|
||||
|
|
|
@ -1138,6 +1138,30 @@ describe('{{ghost_head}} helper', function () {
|
|||
}));
|
||||
});
|
||||
|
||||
it('includes portal when recommendations enabled', async function () {
|
||||
settingsCache.get.withArgs('recommendations_enabled').returns(true);
|
||||
|
||||
await testGhostHead(testUtils.createHbsResponse({
|
||||
locals: {
|
||||
relativeUrl: '/',
|
||||
context: ['home', 'index'],
|
||||
safeVersion: '4.3'
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
it('includes portal when donations enabled', async function () {
|
||||
settingsCache.get.withArgs('donations_enabled').returns(true);
|
||||
|
||||
await testGhostHead(testUtils.createHbsResponse({
|
||||
locals: {
|
||||
relativeUrl: '/',
|
||||
context: ['home', 'index'],
|
||||
safeVersion: '4.3'
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
it('includes stripe when connected', async function () {
|
||||
settingsCache.get.withArgs('members_enabled').returns(true);
|
||||
settingsCache.get.withArgs('paid_members_enabled').returns(true);
|
||||
|
|
Loading…
Add table
Reference in a new issue