0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Renamed var to use namespace

This commit is contained in:
Peter Zimon 2024-10-21 14:12:23 +02:00 committed by Aileen Booker
parent cd6acffe54
commit b0b41e0d86
3 changed files with 8 additions and 8 deletions

View file

@ -1178,7 +1178,7 @@ Object {
<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\\">
<style>@import url(https://fonts.bunny.net/css?family=space-grotesk:700);@import url(https://fonts.bunny.net/css?family=poppins:400,500,600);:root {--ghost-font-heading: Space Grotesk;--ghost-font-body: Poppins;}</style>",
<style>@import url(https://fonts.bunny.net/css?family=space-grotesk:700);@import url(https://fonts.bunny.net/css?family=poppins:400,500,600);:root {--gh-font-heading: Space Grotesk;--gh-font-body: Poppins;}</style>",
}
`;
@ -1253,7 +1253,7 @@ Object {
<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\\">
<style>@import url(https://fonts.bunny.net/css?family=playfair-display:400);@import url(https://fonts.bunny.net/css?family=lora:400,700);:root {--ghost-font-heading: Playfair Display;--ghost-font-body: Lora;}</style>",
<style>@import url(https://fonts.bunny.net/css?family=playfair-display:400);@import url(https://fonts.bunny.net/css?family=lora:400,700);:root {--gh-font-heading: Playfair Display;--gh-font-body: Lora;}</style>",
}
`;

View file

@ -74,11 +74,11 @@ export function generateCustomFontCss(fonts: FontSelection) {
fontCSS = ':root {';
if (fonts?.heading) {
fontCSS += `--ghost-font-heading: ${fonts.heading};`;
fontCSS += `--gh-font-heading: ${fonts.heading};`;
}
if (fonts?.body) {
fontCSS += `--ghost-font-body: ${fonts.body};`;
fontCSS += `--gh-font-body: ${fonts.body};`;
}
fontCSS += '}';

View file

@ -37,8 +37,8 @@ describe('Custom Fonts', function () {
const result = customFonts.generateCustomFontCss({body: 'Noto Sans'});
assert.equal(result.includes('@import url(https://fonts.bunny.net/css?family=noto-sans:400,700);'), true, 'Includes the correct import for the body font');
assert.equal(result.includes(':root {--ghost-font-body: Noto Sans;}'), true, 'Includes the correct CSS for the body font');
assert.equal(result.includes('--ghost-font-heading'), false, 'Does not include CSS for the title font');
assert.equal(result.includes(':root {--gh-font-body: Noto Sans;}'), true, 'Includes the correct CSS for the body font');
assert.equal(result.includes('--gh-font-heading'), false, 'Does not include CSS for the title font');
});
it('returns correct CSS for different heading and body fonts', function () {
@ -46,13 +46,13 @@ describe('Custom Fonts', function () {
assert.equal(result.includes('@import url(https://fonts.bunny.net/css?family=playfair-display:400);'), true, 'Includes the correct import for the heading font');
assert.equal(result.includes('@import url(https://fonts.bunny.net/css?family=poppins:400,500,600);'), true, 'Includes the correct import for the body font');
assert.equal(result.includes(':root {--ghost-font-heading: Playfair Display;--ghost-font-body: Poppins;}'), true, 'Includes the correct CSS for the body and heading fonts');
assert.equal(result.includes(':root {--gh-font-heading: Playfair Display;--gh-font-body: Poppins;}'), true, 'Includes the correct CSS for the body and heading fonts');
});
it('returns correct CSS with only one import for equal heading and body fonts', function () {
const result = customFonts.generateCustomFontCss({heading: 'Lora', body: 'Lora'});
assert.equal(result, '<style>@import url(https://fonts.bunny.net/css?family=lora:400,700);:root {--ghost-font-heading: Lora;--ghost-font-body: Lora;}</style>', 'Includes the correct CSS with only one import for equal heading and body fonts');
assert.equal(result, '<style>@import url(https://fonts.bunny.net/css?family=lora:400,700);:root {--gh-font-heading: Lora;--gh-font-body: Lora;}</style>', 'Includes the correct CSS with only one import for equal heading and body fonts');
});
});
});