summaryrefslogtreecommitdiffstats
path: root/spec/string-params.js
diff options
context:
space:
mode:
Diffstat (limited to 'spec/string-params.js')
-rw-r--r--spec/string-params.js33
1 files changed, 17 insertions, 16 deletions
diff --git a/spec/string-params.js b/spec/string-params.js
index 2e88cf1..4704a84 100644
--- a/spec/string-params.js
+++ b/spec/string-params.js
@@ -1,3 +1,4 @@
+/*global CompilerContext */
describe('string params mode', function() {
it("arguments to helpers can be retrieved from options hash in string form", function() {
var template = CompilerContext.compile('{{wycats is.a slave.driver}}', {stringParams: true});
@@ -56,9 +57,9 @@ describe('string params mode', function() {
var helpers = {
tomdale: function(desire, noun, trueBool, falseBool, options) {
- equal(options.types[0], 'STRING', "the string type is passed");
- equal(options.types[1], 'ID', "the expression type is passed");
- equal(options.types[2], 'BOOLEAN', "the expression type is passed");
+ equal(options.types[0], 'StringLiteral', "the string type is passed");
+ equal(options.types[1], 'PathExpression', "the expression type is passed");
+ equal(options.types[2], 'BooleanLiteral', "the expression type is passed");
equal(desire, "need", "the string form is passed for strings");
equal(noun, "dad.joke", "the string form is passed for expressions");
equal(trueBool, true, "raw booleans are passed through");
@@ -76,21 +77,21 @@ describe('string params mode', function() {
var helpers = {
tomdale: function(exclamation, options) {
- equal(exclamation, "he.says");
- equal(options.types[0], "ID");
-
- equal(options.hashTypes.desire, "STRING");
- equal(options.hashTypes.noun, "ID");
- equal(options.hashTypes.bool, "BOOLEAN");
- equal(options.hash.desire, "need");
- equal(options.hash.noun, "dad.joke");
+ equal(exclamation, 'he.says');
+ equal(options.types[0], 'PathExpression');
+
+ equal(options.hashTypes.desire, 'StringLiteral');
+ equal(options.hashTypes.noun, 'PathExpression');
+ equal(options.hashTypes.bool, 'BooleanLiteral');
+ equal(options.hash.desire, 'need');
+ equal(options.hash.noun, 'dad.joke');
equal(options.hash.bool, true);
- return "Helper called";
+ return 'Helper called';
}
};
var result = template({}, { helpers: helpers });
- equal(result, "Helper called");
+ equal(result, 'Helper called');
});
it("hash parameters get context information", function() {
@@ -101,7 +102,7 @@ describe('string params mode', function() {
var helpers = {
tomdale: function(exclamation, options) {
equal(exclamation, "he.says");
- equal(options.types[0], "ID");
+ equal(options.types[0], 'PathExpression');
equal(options.contexts.length, 1);
equal(options.hashContexts.noun, context);
@@ -164,8 +165,8 @@ describe('string params mode', function() {
var helpers = {
foo: function(bar, options) {
- equal(bar, 'bar');
- equal(options.types[0], 'DATA');
+ equal(bar, '@bar');
+ equal(options.types[0], 'PathExpression');
return 'Foo!';
}
};