forked from enviPath/enviPy
Current Dev State
This commit is contained in:
65
static/js/ketcher2/node_modules/handlebars-wax/test/helpers.js
generated
vendored
Normal file
65
static/js/ketcher2/node_modules/handlebars-wax/test/helpers.js
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
import test from 'ava';
|
||||
import { setup } from './helpers/setup';
|
||||
|
||||
test('should not modify helpers', async t => {
|
||||
const { hb, wax, defaultHelpers } = setup();
|
||||
|
||||
wax.helpers().helpers('./fixtures/helpers/bogu*.js');
|
||||
|
||||
t.deepEqual(Object.keys(hb.helpers), defaultHelpers);
|
||||
});
|
||||
|
||||
test('should register helpers by object', async t => {
|
||||
const { hb, wax } = setup();
|
||||
|
||||
function foo() {}
|
||||
function bar() {}
|
||||
|
||||
wax.helpers({ foo, bar });
|
||||
|
||||
t.is(hb.helpers.foo, foo);
|
||||
t.is(hb.helpers.bar, bar);
|
||||
});
|
||||
|
||||
test('should register helpers by globbed factory', async t => {
|
||||
const { hb, wax } = setup();
|
||||
|
||||
wax.helpers('./fixtures/helpers/factory/**/*.js');
|
||||
|
||||
t.is(typeof hb.helpers.lower, 'function');
|
||||
t.is(typeof hb.helpers.upper, 'function');
|
||||
t.is(typeof hb.helpers.lest, 'function');
|
||||
t.is(typeof hb.helpers.when, 'function');
|
||||
t.is(hb.helpers.empty, undefined);
|
||||
});
|
||||
|
||||
test('should register helpers by globbed function', async t => {
|
||||
const { hb, wax } = setup();
|
||||
|
||||
wax.helpers('./fixtures/helpers/function/**/*.{hbs,js}');
|
||||
|
||||
t.is(typeof hb.helpers.lower, 'function');
|
||||
t.is(typeof hb.helpers.upper, 'function');
|
||||
t.is(typeof hb.helpers['flow-lest'], 'function');
|
||||
t.is(typeof hb.helpers['flow-when'], 'function');
|
||||
t.is(hb.helpers.empty, undefined);
|
||||
});
|
||||
|
||||
test('should register helpers by globbed object', async t => {
|
||||
const { hb, wax } = setup();
|
||||
|
||||
wax.helpers('./fixtures/helpers/object/**/*.js');
|
||||
|
||||
t.is(typeof hb.helpers.lower, 'function');
|
||||
t.is(typeof hb.helpers.upper, 'function');
|
||||
t.is(typeof hb.helpers.lest, 'function');
|
||||
t.is(typeof hb.helpers.when, 'function');
|
||||
t.is(hb.helpers.empty, undefined);
|
||||
});
|
||||
|
||||
test('should raise errors', async t => {
|
||||
const { wax } = setup();
|
||||
const template = wax.compile('{{{foo "bar"}}}');
|
||||
|
||||
t.throws(() => template(), /missing helper/i);
|
||||
});
|
||||
Reference in New Issue
Block a user