summaryrefslogtreecommitdiffstats
path: root/spec/parser.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-08-19 06:59:32 -0700
committerkpdecker <kpdecker@gmail.com>2015-08-22 10:59:34 -0700
commit408192ba9f262bb82be88091ab3ec3c16dc02c6d (patch)
tree5fb9fa403eba8b1e078096b14aaeebf5e8026292 /spec/parser.js
parent2a4a5447f560723a2c898e0a4d97cd929131bba6 (diff)
downloadhandlebars.js-408192ba9f262bb82be88091ab3ec3c16dc02c6d.zip
handlebars.js-408192ba9f262bb82be88091ab3ec3c16dc02c6d.tar.gz
handlebars.js-408192ba9f262bb82be88091ab3ec3c16dc02c6d.tar.bz2
Add decorator parsing
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'