summaryrefslogtreecommitdiffstats
path: root/spec/source-map.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2015-04-16 15:42:46 -0500
committerkpdecker <kpdecker@gmail.com>2015-04-16 16:43:01 -0500
commite3d3eda2e1e03e997d417affc09974446b4ca701 (patch)
treea6513f267482b1693fd002c20488c6e92095ff2b /spec/source-map.js
parent2a02261a5bc78f246c63dd8d467a12f2c1f63734 (diff)
downloadhandlebars.js-e3d3eda2e1e03e997d417affc09974446b4ca701.zip
handlebars.js-e3d3eda2e1e03e997d417affc09974446b4ca701.tar.gz
handlebars.js-e3d3eda2e1e03e997d417affc09974446b4ca701.tar.bz2
Add full support for es6
Converts the tool chain to use babel, eslint, and webpack vs. the previous proprietary solutions. Additionally begins enforcing additional linting concerns as well as updates the code to reflect these rules. Fixes #855 Fixes #993
Diffstat (limited to 'spec/source-map.js')
-rw-r--r--spec/source-map.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/spec/source-map.js b/spec/source-map.js
index 8037b88..54e5e4d 100644
--- a/spec/source-map.js
+++ b/spec/source-map.js
@@ -1,8 +1,7 @@
-/*global CompilerContext, Handlebars */
try {
if (typeof define !== 'function' || !define.amd) {
var SourceMap = require('source-map'),
- SourceMapConsumer = SourceMap.SourceMapConsumer;
+ SourceMapConsumer = SourceMap.SourceMapConsumer;
}
} catch (err) {
/* NOP for in browser */
@@ -20,13 +19,13 @@ describe('source-map', function() {
equal(!!template.map, !CompilerContext.browser);
});
it('should map source properly', function() {
- var source = ' b{{hello}} \n {{bar}}a {{#block arg hash=(subex 1 subval)}}{{/block}}',
- template = Handlebars.precompile(source, {destName: 'dest.js', srcName: 'src.hbs'});
+ var templateSource = ' b{{hello}} \n {{bar}}a {{#block arg hash=(subex 1 subval)}}{{/block}}',
+ template = Handlebars.precompile(templateSource, {destName: 'dest.js', srcName: 'src.hbs'});
if (template.map) {
var consumer = new SourceMapConsumer(template.map),
lines = template.code.split('\n'),
- srcLines = source.split('\n'),
+ srcLines = templateSource.split('\n'),
generated = grepLine('" b"', lines),
source = grepLine(' b', srcLines);
@@ -43,7 +42,7 @@ function grepLine(token, lines) {
var column = lines[i].indexOf(token);
if (column >= 0) {
return {
- line: i+1,
+ line: i + 1,
column: column
};
}