diff --git a/lib/javascripts/widget-hbs-compiler.js.es6 b/lib/javascripts/widget-hbs-compiler.js.es6 index 0f84f1c03d6..2561d9362d2 100644 --- a/lib/javascripts/widget-hbs-compiler.js.es6 +++ b/lib/javascripts/widget-hbs-compiler.js.es6 @@ -11,7 +11,12 @@ function sexp(value) { let result = []; value.hash.pairs.forEach(p => { - result.push(`"${p.key}": ${p.value.original}`); + let pValue = p.value.original; + if (p.value.type === "StringLiteral") { + pValue = JSON.stringify(pValue); + } + + result.push(`"${p.key}": ${pValue}`); }); return `{ ${result.join(", ")} }`; diff --git a/script/test_hbs_compiler.rb b/script/test_hbs_compiler.rb index d18a41fc176..773908c5b4c 100644 --- a/script/test_hbs_compiler.rb +++ b/script/test_hbs_compiler.rb @@ -3,7 +3,7 @@ template = <<~HBS {{a}} {{{htmlValue}}} {{#if state.category}} - {{attach widget="category-display" attrs=(hash category=state.category)}} + {{attach widget="category-display" attrs=(hash category=state.category someNumber=123 someString="wat")}} {{/if}} HBS