test.js 611 B

1234567891011121314151617181920
  1. require('should');
  2. var nunjucks = require('nunjucks');
  3. var DoExtension = require('./')(nunjucks);
  4. describe('nunjucks-do', function() {
  5. var env = new nunjucks.Environment(new nunjucks.FileSystemLoader('views'));
  6. env.addExtension('DoExtension', new DoExtension());
  7. it('should eval js', function() {
  8. env.renderString('Hello {% do %}{% enddo %}World').should.equal('Hello World');
  9. });
  10. it('should eval js in context', function() {
  11. env.renderString('{% do %}test = "So " + test{% enddo %}{{ test }}', {
  12. test: 'Cool'
  13. }).should.equal('So Cool');
  14. });
  15. });