0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Removed ancient Casper fixture

refs: https://github.com/TryGhost/Toolbox/issues/168

- The fixture represented Casper at Ghost version 1.0 which pre-dated the introduction of the posts_per_page config in package.json
- When Casper was upgraded to 2.0 in the fixtures, the lack of pagination broke the e2e tests for pagination
- This change introduces proper code to stub and override posts_per_page rather than keeping and using the old casper-1.4 fixture
- It also required me to remove a handful of CSS-based checks which are no longer true in the new theme version, but also didn't really add anything to the tests
This commit is contained in:
Hannah Wolfe 2022-01-24 12:12:04 +00:00
parent 01f30eb632
commit 2768f5bb72
No known key found for this signature in database
GPG key ID: AB586C3B5AE5C037
13 changed files with 17 additions and 2669 deletions

View file

@ -47,7 +47,7 @@ describe('Themes API', function () {
const jsonResponse = res.body;
should.exist(jsonResponse.themes);
localUtils.API.checkResponse(jsonResponse, 'themes');
jsonResponse.themes.length.should.eql(7);
jsonResponse.themes.length.should.eql(6);
localUtils.API.checkResponse(jsonResponse.themes[0], 'theme');
jsonResponse.themes[0].name.should.eql('broken-theme');
@ -60,29 +60,24 @@ describe('Themes API', function () {
jsonResponse.themes[1].active.should.be.true();
localUtils.API.checkResponse(jsonResponse.themes[2], 'theme');
jsonResponse.themes[2].name.should.eql('casper-1.4');
jsonResponse.themes[2].name.should.eql('locale-theme');
jsonResponse.themes[2].package.should.be.an.Object().with.properties('name', 'version');
jsonResponse.themes[2].active.should.be.false();
localUtils.API.checkResponse(jsonResponse.themes[3], 'theme');
jsonResponse.themes[3].name.should.eql('locale-theme');
jsonResponse.themes[3].name.should.eql('members-test-theme');
jsonResponse.themes[3].package.should.be.an.Object().with.properties('name', 'version');
jsonResponse.themes[3].active.should.be.false();
localUtils.API.checkResponse(jsonResponse.themes[4], 'theme');
jsonResponse.themes[4].name.should.eql('members-test-theme');
jsonResponse.themes[4].name.should.eql('test-theme');
jsonResponse.themes[4].package.should.be.an.Object().with.properties('name', 'version');
jsonResponse.themes[4].active.should.be.false();
localUtils.API.checkResponse(jsonResponse.themes[5], 'theme');
jsonResponse.themes[5].name.should.eql('test-theme');
jsonResponse.themes[5].package.should.be.an.Object().with.properties('name', 'version');
jsonResponse.themes[5].name.should.eql('test-theme-channels');
jsonResponse.themes[5].package.should.be.false();
jsonResponse.themes[5].active.should.be.false();
localUtils.API.checkResponse(jsonResponse.themes[6], 'theme');
jsonResponse.themes[6].name.should.eql('test-theme-channels');
jsonResponse.themes[6].package.should.be.false();
jsonResponse.themes[6].active.should.be.false();
});
it('Can download a theme', async function () {
@ -129,7 +124,7 @@ describe('Themes API', function () {
should.exist(jsonResponse3.themes);
localUtils.API.checkResponse(jsonResponse3, 'themes');
jsonResponse3.themes.length.should.eql(8);
jsonResponse3.themes.length.should.eql(7);
// Casper should be present and still active
const casperTheme = _.find(jsonResponse3.themes, {name: 'casper'});
@ -147,7 +142,6 @@ describe('Themes API', function () {
_.map(jsonResponse3.themes, 'name').should.eql([
'broken-theme',
'casper',
'casper-1.4',
'locale-theme',
'members-test-theme',
'test-theme',
@ -173,12 +167,11 @@ describe('Themes API', function () {
tmpFolderContents.splice(i, 1);
}
}
tmpFolderContents.should.be.an.Array().with.lengthOf(11);
tmpFolderContents.should.be.an.Array().with.lengthOf(10);
tmpFolderContents.should.eql([
'broken-theme',
'casper',
'casper-1.4',
'casper.zip',
'invalid.zip',
'locale-theme',
@ -199,7 +192,7 @@ describe('Themes API', function () {
should.exist(jsonResponse2.themes);
localUtils.API.checkResponse(jsonResponse2, 'themes');
jsonResponse2.themes.length.should.eql(7);
jsonResponse2.themes.length.should.eql(6);
// Casper should be present and still active
const casperTheme = _.find(jsonResponse2.themes, {name: 'casper'});
@ -241,7 +234,7 @@ describe('Themes API', function () {
should.exist(jsonResponse.themes);
localUtils.API.checkResponse(jsonResponse, 'themes');
jsonResponse.themes.length.should.eql(7);
jsonResponse.themes.length.should.eql(6);
const casperTheme = _.find(jsonResponse.themes, {name: 'casper'});
should.exist(casperTheme);

View file

@ -10,7 +10,7 @@ const testUtils = require('../../utils');
const configUtils = require('../../utils/configUtils');
const cheerio = require('cheerio');
const config = require('../../../core/shared/config');
const settingsCache = require('../../../core/shared/settings-cache');
const themeEngine = require('../../../core/frontend/services/theme-engine');
let request;
@ -31,18 +31,9 @@ describe('Dynamic Routing', function () {
}
before(function () {
// Default is always casper. We use the old compatible 1.4 casper theme for these tests. Available in the test content folder.
const originalSettingsCacheGetFn = settingsCache.get;
sinon.stub(settingsCache, 'get').callsFake(function (key, options) {
if (key === 'active_theme') {
return 'casper-1.4';
}
return originalSettingsCacheGetFn(key, options);
});
return testUtils.startGhost()
.then(function () {
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(5);
request = supertest.agent(config.get('url'));
});
});
@ -70,8 +61,6 @@ describe('Dynamic Routing', function () {
should.exist(res.headers.date);
$('title').text().should.equal('Ghost');
$('.content .post').length.should.equal(5);
$('.poweredby').text().should.equal('Proudly published with Ghost');
$('body.home-template').length.should.equal(1);
$('article.post').length.should.equal(5);
$('article.tag-getting-started').length.should.equal(5);
@ -150,9 +139,7 @@ describe('Dynamic Routing', function () {
should.not.exist(res.headers['set-cookie']);
should.exist(res.headers.date);
$('body').attr('class').should.eql('tag-template tag-getting-started nav-closed');
$('.content .post').length.should.equal(5);
$('.poweredby').text().should.equal('Proudly published with Ghost');
$('body').attr('class').should.eql('tag-template tag-getting-started');
$('article.post').length.should.equal(5);
$('article.tag-getting-started').length.should.equal(5);
@ -234,6 +221,7 @@ describe('Dynamic Routing', function () {
return testUtils.startGhost({forceStart: true})
.then(function () {
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(5);
request = supertest.agent(config.get('url'));
});
});
@ -243,6 +231,7 @@ describe('Dynamic Routing', function () {
return testUtils.startGhost({forceStart: true})
.then(function () {
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(5);
request = supertest.agent(config.get('url'));
});
});
@ -428,6 +417,7 @@ describe('Dynamic Routing', function () {
return testUtils.startGhost({forceStart: true})
.then(function () {
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(5);
request = supertest.agent(config.get('url'));
});
});
@ -437,6 +427,7 @@ describe('Dynamic Routing', function () {
return testUtils.startGhost({forceStart: true})
.then(function () {
sinon.stub(themeEngine.getActive(), 'config').withArgs('posts_per_page').returns(5);
request = supertest.agent(config.get('url'));
});
});

View file

@ -1,7 +0,0 @@
# Casper
The default theme for [Ghost](http://github.com/tryghost/ghost/). Casper 1.4 is the last release of Casper's original design, created to be compatible **ONLY with Ghost 1.0** and above. If you are running an earlier version of Ghost, you will need [Casper 1.3.7](https://github.com/TryGhost/Casper/releases/tag/1.3.7). For all other versions of Ghost, we recommend switching to the [latest release](https://github.com/TryGhost/Casper/releases) of Casper, with an updated design.
## Copyright & License
Copyright (c) 2013-2020 Ghost Foundation - Released under the [MIT license](LICENSE).

File diff suppressed because it is too large Load diff

View file

@ -1,41 +0,0 @@
{{!< default}}
{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}}
{{!-- The big featured header --}}
{{!-- Everything inside the #author tags pulls data from the author --}}
{{#author}}
<header class="main-header author-head {{#if cover_image}}" style="background-image: url({{cover_image}}){{else}}no-cover{{/if}}">
<nav class="main-nav overlay clearfix">
{{#if @blog.logo}}<a class="blog-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="{{@blog.title}}" /></a>{{/if}}
{{#if @blog.navigation}}
<a class="menu-button icon-menu" href="#"><span class="word">Menu</span></a>
{{/if}}
</nav>
</header>
<section class="author-profile inner">
{{#if profile_image}}
<figure class="author-image">
<div class="img" style="background-image: url({{profile_image}})"><span class="hidden">{{name}}'s Picture</span></div>
</figure>
{{/if}}
<h1 class="author-title">{{name}}</h1>
{{#if bio}}
<h2 class="author-bio">{{bio}}</h2>
{{/if}}
<div class="author-meta">
{{#if location}}<span class="author-location icon-location">{{location}}</span>{{/if}}
{{#if website}}<span class="author-link icon-link"><a href="{{website}}">{{website}}</a></span>{{/if}}
<span class="author-stats"><i class="icon-stats"></i> {{plural ../pagination.total empty='No posts' singular='% post' plural='% posts'}}</span>
</div>
</section>
{{/author}}
{{!-- The main content area on the homepage --}}
<main class="content" role="main">
{{!-- The tag below includes the post loop - partials/loop.hbs --}}
{{> "loop"}}
</main>

View file

@ -1,51 +0,0 @@
<!DOCTYPE html>
<html>
<head>
{{!-- Document Settings --}}
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
{{!-- Page Meta --}}
<title>{{meta_title}}</title>
{{!-- Mobile Meta --}}
<meta name="HandheldFriendly" content="True" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
{{!-- Styles'n'Scripts --}}
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />
<link rel="stylesheet" type="text/css" href="{{asset "css/screen.css"}}" />
{{!-- Ghost outputs important style and meta data with this tag --}}
{{ghost_head}}
</head>
<body class="{{body_class}} nav-closed">
{{!-- The blog navigation links --}}
{{navigation}}
<div class="site-wrapper">
{{!-- All the main content gets inserted here, index.hbs, post.hbs, etc --}}
{{{body}}}
{{!-- The tiny footer at the very bottom --}}
<footer class="site-footer clearfix">
<section class="copyright"><a href="{{@blog.url}}">{{@blog.title}}</a> &copy; {{date format="YYYY"}}</section>
<section class="poweredby">Proudly published with <a href="https://ghost.org">Ghost</a></section>
</footer>
</div>
{{!-- jQuery needs to come before `{{ghost_foot}}` so that jQuery can be used in code injection --}}
<script type="text/javascript" src="//code.jquery.com/jquery-1.12.0.min.js"></script>
{{!-- Ghost outputs important scripts and data with this tag --}}
{{ghost_foot}}
{{!-- Fitvids makes video embeds responsive and awesome --}}
<script type="text/javascript" src="{{asset "js/jquery.fitvids.js"}}"></script>
{{!-- The main JavaScript file for Casper --}}
<script type="text/javascript" src="{{asset "js/events.js"}}"></script>
</body>
</html>

View file

@ -1,27 +0,0 @@
{{!< default}}
{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}}
{{!-- The big featured header --}}
<header class="main-header {{#if @blog.cover_image}}" style="background-image: url({{@blog.cover_image}}){{else}}no-cover{{/if}}">
<nav class="main-nav overlay clearfix">
{{#if @blog.logo}}<a class="blog-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="{{@blog.title}}" /></a>{{/if}}
{{#if @blog.navigation}}
<a class="menu-button icon-menu" href="#"><span class="word">Menu</span></a>
{{/if}}
</nav>
<div class="vertical">
<div class="main-header-content inner">
<h1 class="page-title">{{@blog.title}}</h1>
<h2 class="page-description">{{@blog.description}}</h2>
</div>
</div>
<a class="scroll-down icon-arrow-left" href="#content" data-offset="-45"><span class="hidden">Scroll Down</span></a>
</header>
{{!-- The main content area on the homepage --}}
<main id="content" class="content" role="main">
{{!-- The tag below includes the post loop - partials/loop.hbs --}}
{{> "loop"}}
</main>

View file

@ -1,40 +0,0 @@
{
"name": "casper",
"description": "The default personal blogging theme for Ghost. Beautiful, minimal and responsive.",
"demo": "https://demo.ghost.io",
"version": "1.4.0",
"engines": {
"ghost": ">=0.9.0 <1.0.0",
"ghost-api": "v2"
},
"license": "MIT",
"screenshots": {
"desktop": "assets/screenshot-desktop.jpg",
"mobile": "assets/screenshot-mobile.jpg"
},
"author": {
"name": "Ghost Foundation",
"email": "hello@ghost.org",
"url": "https://ghost.org"
},
"gpm": {
"type": "theme",
"categories": [
"Minimal",
"Personal Blogs"
]
},
"config": {
"posts_per_page": 5
},
"keywords": [
"ghost",
"theme"
],
"repository": {
"type": "git",
"url": "https://github.com/TryGhost/Casper.git"
},
"bugs": "https://github.com/TryGhost/Casper/issues",
"contributors": "https://github.com/TryGhost/Casper/graphs/contributors"
}

View file

@ -1,31 +0,0 @@
{{!< default}}
{{!-- This is a page template. A page outputs content just like any other post, and has all the same
attributes by default, but you can also customize it to behave differently if you prefer. --}}
{{!-- Everything inside the #post tags pulls data from the page --}}
{{#post}}
<header class="main-header post-head {{#if feature_image}}" style="background-image: url({{feature_image}}){{else}}no-cover{{/if}}">
<nav class="main-nav {{#if feature_image}}overlay{{/if}} clearfix">
{{#if @blog.logo}}<a class="blog-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="{{@blog.title}}" /></a>{{/if}}
{{#if @blog.navigation}}
<a class="menu-button icon-menu" href="#"><span class="word">Menu</span></a>
{{/if}}
</nav>
</header>
<main class="content" role="main">
<article class="{{post_class}}">
<header class="post-header">
<h1 class="post-title">{{title}}</h1>
</header>
<section class="post-content">
{{content}}
</section>
</article>
</main>
{{/post}}

View file

@ -1,25 +0,0 @@
{{!-- Previous/next page links - only displayed on page 2+ --}}
<div class="extra-pagination inner">
{{pagination}}
</div>
{{!-- This is the post loop - each post will be output using this markup --}}
{{#foreach posts}}
<article class="{{post_class}}">
<header class="post-header">
<h2 class="post-title"><a href="{{url}}">{{title}}</a></h2>
</header>
<section class="post-excerpt">
<p>{{excerpt words="26"}} <a class="read-more" href="{{url}}">&raquo;</a></p>
</section>
<footer class="post-meta">
{{#if author.profile_image}}<img class="author-thumb" src="{{author.profile_image}}" alt="{{author.name}}" nopin="nopin" />{{/if}}
{{author}}
{{tags prefix=" on "}}
<time class="post-date" datetime="{{date format="YYYY-MM-DD"}}">{{date format="DD MMMM YYYY"}}</time>
</footer>
</article>
{{/foreach}}
{{!-- Previous/next page links - displayed on every page --}}
{{pagination}}

View file

@ -1,17 +0,0 @@
<div class="nav">
<h3 class="nav-title">Menu</h3>
<a href="#" class="nav-close">
<span class="hidden">Close</span>
</a>
<ul>
{{#foreach navigation}}
<li class="nav-{{slug}}{{#if current}} nav-current{{/if}}"><a href="{{url absolute="true"}}">{{label}}</a></li>
{{/foreach}}
</ul>
{{#if @labs.subscribers}}
<a class="subscribe-button" href="{{@blog.url}}/subscribe/">Subscribe</a>
{{else}}
<a class="subscribe-button icon-feed" href="{{@blog.url}}/rss/">Subscribe</a>
{{/if}}
</div>
<span class="nav-cover"></span>

View file

@ -1,110 +0,0 @@
{{!< default}}
{{!-- The comment above "< default" means - insert everything in this file into
the {{{body}}} of the default.hbs template, containing the blog header/footer. --}}
{{!-- Everything inside the #post tags pulls data from the post --}}
{{#post}}
<header class="main-header post-head {{#if feature_image}}" style="background-image: url({{feature_image}}){{else}}no-cover{{/if}}">
<nav class="main-nav {{#if feature_image}}overlay{{/if}} clearfix">
{{#if @blog.logo}}<a class="blog-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="{{@blog.title}}" /></a>{{/if}}
{{#if @blog.navigation}}
<a class="menu-button icon-menu" href="#"><span class="word">Menu</span></a>
{{/if}}
</nav>
</header>
<main class="content" role="main">
<article class="{{post_class}}">
<header class="post-header">
<h1 class="post-title">{{title}}</h1>
<section class="post-meta">
<time class="post-date" datetime="{{date format="YYYY-MM-DD"}}">{{date format="DD MMMM YYYY"}}</time> {{tags prefix=" on "}}
</section>
</header>
<section class="post-content">
{{content}}
</section>
<footer class="post-footer">
{{!-- Everything inside the #author tags pulls data from the author --}}
{{#author}}
{{#if profile_image}}
<figure class="author-image">
<a class="img" href="{{url}}" style="background-image: url({{profile_image}})"><span class="hidden">{{name}}'s Picture</span></a>
</figure>
{{/if}}
<section class="author">
<h4><a href="{{url}}">{{name}}</a></h4>
{{#if bio}}
<p>{{bio}}</p>
{{else}}
<p>Read <a href="{{url}}">more posts</a> by this author.</p>
{{/if}}
<div class="author-meta">
{{#if location}}<span class="author-location icon-location">{{location}}</span>{{/if}}
{{#if website}}<span class="author-link icon-link"><a href="{{website}}">{{website}}</a></span>{{/if}}
</div>
</section>
{{/author}}
<section class="share">
<h4>Share this post</h4>
<a class="icon-twitter" href="https://twitter.com/intent/tweet?text={{encode title}}&amp;url={{url absolute="true"}}"
onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;">
<span class="hidden">Twitter</span>
</a>
<a class="icon-facebook" href="https://www.facebook.com/sharer/sharer.php?u={{url absolute="true"}}"
onclick="window.open(this.href, 'facebook-share','width=580,height=296');return false;">
<span class="hidden">Facebook</span>
</a>
<a class="icon-google-plus" href="https://plus.google.com/share?url={{url absolute="true"}}"
onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;">
<span class="hidden">Google+</span>
</a>
</section>
{{!-- Email subscribe form at the bottom of the page --}}
{{#if @labs.subscribers}}
<section class="gh-subscribe">
<h3 class="gh-subscribe-title">Subscribe to {{@blog.title}}</h3>
<p>Get the latest posts delivered right to your inbox.</p>
{{subscribe_form placeholder="Your email address"}}
<span class="gh-subscribe-rss">or subscribe <a href="http://cloud.feedly.com/#subscription/feed/{{@blog.url}}/rss/">via RSS</a> with Feedly!</span>
</section>
{{/if}}
</footer>
</article>
</main>
{{!-- Links to Previous/Next posts --}}
<aside class="read-next">
{{#next_post}}
<a class="read-next-story {{#if feature_image}}" style="background-image: url({{feature_image}}){{else}}no-cover{{/if}}" href="{{url}}">
<section class="post">
<h2>{{title}}</h2>
<p>{{excerpt words="19"}}&hellip;</p>
</section>
</a>
{{/next_post}}
{{#prev_post}}
<a class="read-next-story prev {{#if feature_image}}" style="background-image: url({{feature_image}}){{else}}no-cover{{/if}}" href="{{url}}">
<section class="post">
<h2>{{title}}</h2>
<p>{{excerpt words="19"}}&hellip;</p>
</section>
</a>
{{/prev_post}}
</aside>
{{/post}}

View file

@ -1,34 +0,0 @@
{{!< default}}
{{!-- The tag above means - insert everything in this file into the {body} of the default.hbs template --}}
{{!-- If we have a tag cover, display that - else blog cover - else nothing --}}
<header class="main-header tag-head {{#if tag.feature_image}}" style="background-image: url({{tag.feature_image}}){{else}}{{#if @blog.cover_image}}" style="background-image: url({{@blog.cover_image}}){{else}}no-cover{{/if}}{{/if}}">
<nav class="main-nav overlay clearfix">
{{#if @blog.logo}}<a class="blog-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="{{@blog.title}}" /></a>{{/if}}
{{#if @blog.navigation}}
<a class="menu-button icon-menu" href="#"><span class="word">Menu</span></a>
{{/if}}
</nav>
<div class="vertical">
{{#tag}}
<div class="main-header-content inner">
<h1 class="page-title">{{name}}</h1>
<h2 class="page-description">
{{#if description}}
{{description}}
{{else}}
A {{../pagination.total}}-post collection
{{/if}}
</h2>
</div>
{{/tag}}
</div>
</header>
{{!-- The main content area on the homepage --}}
<main class="content" role="main">
{{!-- The tag below includes the post loop - partials/loop.hbs --}}
{{> "loop"}}
</main>