summaryrefslogtreecommitdiffstats
path: root/spec/parser.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/parser.js')
-rw-r--r--spec/parser.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/parser.js b/spec/parser.js
index 5b60f93..3b7e3e4 100644
--- a/spec/parser.js
+++ b/spec/parser.js
@@ -247,6 +247,20 @@ describe('parser', function() {
});
});
+ describe('directives', function() {
+ it('should parse block directives', function() {
+ equals(astFor('{{#* foo}}{{/foo}}'), 'DIRECTIVE BLOCK:\n PATH:foo []\n PROGRAM:\n');
+ });
+ it('should parse directives', function() {
+ equals(astFor('{{* foo}}'), '{{ DIRECTIVE PATH:foo [] }}\n');
+ });
+ it('should fail if directives have inverse', function() {
+ shouldThrow(function() {
+ astFor('{{#* foo}}{{^}}{{/foo}}');
+ }, Error, /Unexpected inverse/);
+ });
+ });
+
it('GH1024 - should track program location properly', function() {
var p = Handlebars.parse('\n'
+ ' {{#if foo}}\n'