Skip to content

Commit

Permalink
Convert remaining shouldCompileTo() to expectTemplate()
Browse files Browse the repository at this point in the history
  • Loading branch information
jbboehr committed Apr 26, 2020
1 parent 43d4427 commit 6b164bc
Show file tree
Hide file tree
Showing 11 changed files with 1,574 additions and 1,629 deletions.
704 changes: 332 additions & 372 deletions spec/basic.js

Large diffs are not rendered by default.

336 changes: 159 additions & 177 deletions spec/blocks.js

Large diffs are not rendered by default.

376 changes: 219 additions & 157 deletions spec/builtins.js

Large diffs are not rendered by default.

483 changes: 230 additions & 253 deletions spec/helpers.js

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions spec/javascript-compiler.js
Expand Up @@ -20,14 +20,18 @@ describe('javascript-compiler api', function() {
return parent + '.bar_' + name;
};
/* eslint-disable camelcase */
shouldCompileTo('{{foo}}', { bar_foo: 'food' }, 'food');
expectTemplate('{{foo}}')
.withInput({ bar_foo: 'food' })
.toCompileTo('food');
/* eslint-enable camelcase */
});

// Tests nameLookup dot vs. bracket behavior. Bracket is required in certain cases
// to avoid errors in older browsers.
it('should handle reserved words', function() {
shouldCompileTo('{{foo}} {{~null~}}', { foo: 'food' }, 'food');
expectTemplate('{{foo}} {{~null~}}')
.withInput({ foo: 'food' })
.toCompileTo('food');
});
});
describe('#compilerInfo', function() {
Expand All @@ -49,7 +53,9 @@ describe('javascript-compiler api', function() {
throw new Error("It didn't work");
}
};
shouldCompileTo('{{foo}} ', { foo: 'food' }, 'food ');
expectTemplate('{{foo}} ')
.withInput({ foo: 'food' })
.toCompileTo('food ');
});
});
describe('buffer', function() {
Expand All @@ -70,15 +76,19 @@ describe('javascript-compiler api', function() {
handlebarsEnv.JavaScriptCompiler.prototype.initializeBuffer = function() {
return this.quotedString('foo_');
};
shouldCompileTo('{{foo}} ', { foo: 'food' }, 'foo_food ');
expectTemplate('{{foo}} ')
.withInput({ foo: 'food' })
.toCompileTo('foo_food ');
});
it('should allow append buffer override', function() {
handlebarsEnv.JavaScriptCompiler.prototype.appendToBuffer = function(
string
) {
return $superAppend.call(this, [string, ' + "_foo"']);
};
shouldCompileTo('{{foo}}', { foo: 'food' }, 'food_foo');
expectTemplate('{{foo}}')
.withInput({ foo: 'food' })
.toCompileTo('food_foo');
});
});

Expand Down

0 comments on commit 6b164bc

Please sign in to comment.