mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-19 16:42:17 +03:00
af6137248d
fixes #1765 fixes #1811 issue #1833 New UrlFor functions - moved body of url helper to config.path.urlFor, which can generate a URL for various scenarios - urlFor can take a string (name) or object (relativeUrl: '/') as the first argument - this is the first step towards issue #1833 - also added config.path.urlForPost which is async and handles getting permalink setting - frontend controller, ghost_head helper, cache invalidation all now use urlFor or urlForPost all urls should be correct and consistent URL Consistency Improvements - refactored invalidateCache into cacheInvalidationHeader which returns a promise so that url can be generated properly by urlForPost - moved isPost from models to schema, and refactored schema to have a tables object - deleted posts now return the whole object, not just id and slug, ensuring cache invalidation header can be set on delete - frontend controller rss and archive page redirects work properly with subdirectory - removes {{url}} helper from admin and client, and replaced with adminUrl helper which also uses urlFor - in res.locals ghostRoot becomes relativeUrl, and path is removed
34 lines
1.6 KiB
JavaScript
34 lines
1.6 KiB
JavaScript
/**
|
|
* Tests the default post page
|
|
*/
|
|
|
|
/*globals CasperTest, casper, __utils__, url, testPost, falseUser, email */
|
|
|
|
// Tests when permalinks is set to date
|
|
CasperTest.begin('Post page does not load as slug', 2, function suite(test) {
|
|
CasperTest.Routines.togglePermalinks.run('on');
|
|
casper.thenOpen(url + 'welcome-to-ghost', function then(response) {
|
|
test.assertTitle('404 — Page Not Found', 'The post should return 404 page');
|
|
test.assertElementCount('.content .post', 0, 'There is no post on this page');
|
|
});
|
|
CasperTest.Routines.togglePermalinks.run('off');
|
|
}, false);
|
|
|
|
CasperTest.begin('Post page loads', 3, function suite(test) {
|
|
casper.thenOpen(url + 'welcome-to-ghost', function then(response) {
|
|
test.assertTitle('Welcome to Ghost', 'The post should have a title and it should be "Welcome to Ghost"');
|
|
test.assertElementCount('.content .post', 1, 'There is exactly one post on this page');
|
|
test.assertSelectorHasText('.poweredby', 'Proudly published with Ghost');
|
|
});
|
|
}, true);
|
|
|
|
CasperTest.begin('Test helpers on welcome post', 4, function suite(test) {
|
|
casper.start(url + 'welcome-to-ghost', function then(response) {
|
|
// body class
|
|
test.assertExists('body.post-template', 'body_class outputs correct post-template class');
|
|
test.assertExists('body.tag-getting-started', 'body_class outputs correct tag class');
|
|
// post class
|
|
test.assertExists('article.post', 'post_class outputs correct post class');
|
|
test.assertExists('article.tag-getting-started', 'post_class outputs correct tag class');
|
|
});
|
|
}, true); |