mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-13 14:39:52 +03:00
Merge pull request #3611 from ErisDS/author-classes
Adding missing body class for author pages
This commit is contained in:
commit
22171fd058
@ -411,6 +411,11 @@ coreHelpers.body_class = function (options) {
|
||||
classes.push('tag-' + this.tag.slug);
|
||||
}
|
||||
|
||||
if (this.author !== undefined) {
|
||||
classes.push('author-template');
|
||||
classes.push('author-' + this.author.slug);
|
||||
}
|
||||
|
||||
if (tags) {
|
||||
classes = classes.concat(tags.map(function (tag) { return 'tag-' + tag.slug; }));
|
||||
}
|
||||
|
@ -399,21 +399,27 @@ describe('Core Helpers', function () {
|
||||
helpers.body_class.call({relativeUrl: '/a-post-title', post: {}}),
|
||||
helpers.body_class.call({relativeUrl: '/page/4'}),
|
||||
helpers.body_class.call({relativeUrl: '/tag/foo', tag: { slug: 'foo'}}),
|
||||
helpers.body_class.call({relativeUrl: '/tag/foo/page/2', tag: { slug: 'foo'}})
|
||||
helpers.body_class.call({relativeUrl: '/tag/foo/page/2', tag: { slug: 'foo'}}),
|
||||
helpers.body_class.call({relativeUrl: '/author/bar', author: { slug: 'bar'}}),
|
||||
helpers.body_class.call({relativeUrl: '/author/bar/page/2', author: { slug: 'bar'}})
|
||||
]).then(function (rendered) {
|
||||
rendered.length.should.equal(5);
|
||||
rendered.length.should.equal(7);
|
||||
|
||||
should.exist(rendered[0]);
|
||||
should.exist(rendered[1]);
|
||||
should.exist(rendered[2]);
|
||||
should.exist(rendered[3]);
|
||||
should.exist(rendered[4]);
|
||||
should.exist(rendered[5]);
|
||||
should.exist(rendered[6]);
|
||||
|
||||
rendered[0].string.should.equal('home-template');
|
||||
rendered[1].string.should.equal('post-template');
|
||||
rendered[2].string.should.equal('archive-template');
|
||||
rendered[3].string.should.equal('tag-template tag-foo');
|
||||
rendered[4].string.should.equal('archive-template tag-template tag-foo');
|
||||
rendered[5].string.should.equal('author-template author-bar');
|
||||
rendered[6].string.should.equal('archive-template author-template author-bar');
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
Loading…
Reference in New Issue
Block a user