mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 10:21:36 +03:00
df7e64fafa
refs #10790 - Moved /core/apps into core/frontend - Moved /core/server/helpers to /core/frontend/helpers along with /core/server/services/themes - Changed helper location in overrides - Moved /core/server/services/routing to /core/frontend/services - Moved /core/server/services/url to /core/frontend/services - Moved /core/server/data/meta to /core/frontend/meta - Moved /core/server/services/rss to /core/frontend/services - Moved /core/server/data/xml to /core/frontend/services
63 lines
1.7 KiB
JavaScript
63 lines
1.7 KiB
JavaScript
var should = require('should'),
|
|
|
|
// Stuff we are testing
|
|
helpers = require('../../../frontend/helpers');
|
|
|
|
describe('{{plural}} helper', function () {
|
|
it('will show no-value string', function () {
|
|
var expected = 'No Posts',
|
|
rendered = helpers.plural.call({}, 0, {
|
|
hash: {
|
|
empty: 'No Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
|
|
it('will show no-value string with placement', function () {
|
|
var expected = '0 Posts',
|
|
rendered = helpers.plural.call({}, 0, {
|
|
hash: {
|
|
empty: '% Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
|
|
it('will show singular string', function () {
|
|
var expected = '1 Post',
|
|
rendered = helpers.plural.call({}, 1, {
|
|
hash: {
|
|
empty: 'No Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
|
|
it('will show plural string', function () {
|
|
var expected = '2 Posts',
|
|
rendered = helpers.plural.call({}, 2, {
|
|
hash: {
|
|
empty: 'No Posts',
|
|
singular: '% Post',
|
|
plural: '% Posts'
|
|
}
|
|
});
|
|
|
|
should.exist(rendered);
|
|
rendered.string.should.equal(expected);
|
|
});
|
|
});
|