2018-06-02 22:48:23 +03:00
|
|
|
var should = require('should'),
|
2014-10-10 18:54:07 +04:00
|
|
|
|
2019-08-19 14:41:09 +03:00
|
|
|
// Stuff we are testing
|
2019-06-19 12:30:28 +03:00
|
|
|
helpers = require('../../../frontend/helpers');
|
2014-10-10 18:54:07 +04:00
|
|
|
|
|
|
|
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);
|
|
|
|
});
|
|
|
|
|
2015-09-22 18:00:20 +03:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
|
2014-10-10 18:54:07 +04:00
|
|
|
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);
|
|
|
|
});
|
|
|
|
});
|