summaryrefslogtreecommitdiffstats
path: root/spec/parser_spec.rb
diff options
context:
space:
mode:
authortomhuda <tomhuda@tilde.io>2012-07-12 10:07:10 -0700
committertomhuda <tomhuda@tilde.io>2012-07-12 10:07:10 -0700
commitf79af6bfa3081187907c2615ddc3708915b5e44c (patch)
tree6dea69aaece417a85ab6445a32671d3119883423 /spec/parser_spec.rb
parent92b6c1401a95a1550524d264b1e5f4494f9a587f (diff)
parentefb1e25690e5c05b1d1662d72cac31f3cb90b67f (diff)
downloadhandlebars.js-f79af6bfa3081187907c2615ddc3708915b5e44c.zip
handlebars.js-f79af6bfa3081187907c2615ddc3708915b5e44c.tar.gz
handlebars.js-f79af6bfa3081187907c2615ddc3708915b5e44c.tar.bz2
Merge branch 'master' of github.com:wycats/handlebars.js
Diffstat (limited to 'spec/parser_spec.rb')
-rw-r--r--spec/parser_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb
index 8dd13a4..3fe9029 100644
--- a/spec/parser_spec.rb
+++ b/spec/parser_spec.rb
@@ -110,6 +110,10 @@ describe "Parser" do
"ID:#{id}"
end
+ def data(id)
+ "@#{id}"
+ end
+
def path(*parts)
"PATH:#{parts.join("/")}"
end
@@ -119,6 +123,10 @@ describe "Parser" do
ast_for("{{foo}}").should == root { mustache id("foo") }
end
+ it "parses simple mustaches with data" do
+ ast_for("{{@foo}}").should == root { mustache data("foo") }
+ end
+
it "parses mustaches with paths" do
ast_for("{{foo/bar}}").should == root { mustache path("foo", "bar") }
end
@@ -152,6 +160,10 @@ describe "Parser" do
mustache id("foo"), [], hash(["bar", boolean("false")])
end
+ ast_for("{{foo bar=@baz}}").should == root do
+ mustache id("foo"), [], hash(["bar", data("baz")])
+ end
+
ast_for("{{foo bar=baz bat=bam}}").should == root do
mustache id("foo"), [], hash(["bar", "ID:baz"], ["bat", "ID:bam"])
end
@@ -190,6 +202,10 @@ describe "Parser" do
ast_for("{{foo false}}").should == root { mustache id("foo"), [boolean("false")] }
end
+ it "parses mutaches with DATA parameters" do
+ ast_for("{{foo @bar}}").should == root { mustache id("foo"), [data("bar")] }
+ end
+
it "parses contents followed by a mustache" do
ast_for("foo bar {{baz}}").should == root do
content "foo bar "