mirror of
https://github.com/Mibew/mibew.git
synced 2025-05-11 22:33:07 +03:00
Add tests for "ifEven" and "ifOdd" Handlebars.js helpers
This commit is contained in:
parent
3f3abb4255
commit
814869ec77
@ -72,6 +72,42 @@ test('apply', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Test "ifEven" Handlebars helper
|
||||||
|
test('ifEven', function() {
|
||||||
|
var template = '{{#ifEven foo}}true{{else}}false{{/ifEven}}';
|
||||||
|
var compiledTemplate = Handlebars.compile(template);
|
||||||
|
|
||||||
|
equal(
|
||||||
|
compiledTemplate({foo: 0}),
|
||||||
|
'true',
|
||||||
|
'Test even value'
|
||||||
|
);
|
||||||
|
|
||||||
|
equal(
|
||||||
|
compiledTemplate({foo: 1}),
|
||||||
|
'false',
|
||||||
|
'Test odd value'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test "ifOdd" Handlebars helper
|
||||||
|
test('ifOdd', function() {
|
||||||
|
var template = '{{#ifOdd foo}}true{{else}}false{{/ifOdd}}';
|
||||||
|
var compiledTemplate = Handlebars.compile(template);
|
||||||
|
|
||||||
|
equal(
|
||||||
|
compiledTemplate({foo: 0}),
|
||||||
|
'false',
|
||||||
|
'Test even value'
|
||||||
|
);
|
||||||
|
|
||||||
|
equal(
|
||||||
|
compiledTemplate({foo: 1}),
|
||||||
|
'true',
|
||||||
|
'Test odd value'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// Test "ifAny" Handlebars helper
|
// Test "ifAny" Handlebars helper
|
||||||
test('ifAny', function() {
|
test('ifAny', function() {
|
||||||
var template = '{{#ifAny foo bar baz}}true{{else}}false{{/ifAny}}';
|
var template = '{{#ifAny foo bar baz}}true{{else}}false{{/ifAny}}';
|
||||||
|
Loading…
Reference in New Issue
Block a user