-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for habdlebars helpers used in comple mode
- Loading branch information
Showing
4 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
test/cases/_preprocessor/js-tmpl-hbs-compile-helpers/expected/app.js
Large diffs are not rendered by default.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
test/cases/_preprocessor/js-tmpl-hbs-compile-helpers/src/app.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
<p>Hello {{#bold}}{{helloName}}{{/bold}}!</p> | ||
{{#h1}}Header{{/h1}} | ||
<p>{{#italic}}Hello{{/italic}} {{#bold}}{{helloName}}{{/bold}}!</p> | ||
{{> 'footer'}} |
10 changes: 10 additions & 0 deletions
10
test/cases/_preprocessor/js-tmpl-hbs-compile-helpers/src/helpers-esm/html-helpers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//import Handlebars from 'handlebars'; // not works! | ||
const Handlebars = require('handlebars'); | ||
|
||
export const h1 = function (options) { | ||
return new Handlebars.SafeString(`<h1>${options.fn(this)}</h1>`); | ||
}; | ||
|
||
export const italic = function (options) { | ||
return new Handlebars.SafeString(`<i>${options.fn(this)}</i>`); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters