Procházet zdrojové kódy

Add test cases for custom functions in partials

pull/713/head
Enno Woortmann GitHub před 6 roky
rodič
revize
307b725043
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
1 změnil soubory, kde provedl 19 přidání a 1 odebrání
  1. +19
    -1
      test/partial-test.js

+ 19
- 1
test/partial-test.js Zobrazit soubor

@@ -109,4 +109,22 @@ describe('Partials spec', function () {
var renderResult = Mustache.render(template, data, partials);
assert.equal(renderResult, expected);
});
});

it('Partial should inherit functions without indentation.', function () {
var template = '{{> partial }}';
var data = {t: () => (label) => label.toUpperCase()};
var partials = {partial: '{{ #t }}Input{{ /t }}:'};
var expected = 'INPUT:';
var renderResult = Mustache.render(template, data, partials);
assert.equal(renderResult, expected);
});

it('Partial should inherit functions with indentation.', function () {
var template = ' {{> partial }}';
var data = {t: () => (label) => label.toUpperCase()};
var partials = {partial: '{{ #t }}Input{{ /t }}:'};
var expected = ' INPUT:';
var renderResult = Mustache.render(template, data, partials);
assert.equal(renderResult, expected);
});
});

Načítá se…
Zrušit
Uložit