express-hbs 3.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/README.md +2 -2
  2. package/lib/hbs.js +7 -1
  3. package/package.json +16 -12
  4. package/.editorconfig +0 -8
  5. package/.github/workflows/publish.yml +0 -73
  6. package/.github/workflows/test.yml +0 -48
  7. package/.jsbeautifyrc +0 -17
  8. package/.nvmrc +0 -1
  9. package/.nycrc.json +0 -16
  10. package/.oxfmtrc.json +0 -19
  11. package/.oxlintrc.json +0 -32
  12. package/AGENTS.md +0 -40
  13. package/SECURITY.md +0 -9
  14. package/example/app-layoutsDir.js +0 -99
  15. package/example/app.js +0 -103
  16. package/example/public/css/style.css +0 -17
  17. package/example/views/fruits/details-layoutsDir.hbs +0 -3
  18. package/example/views/fruits/details.hbs +0 -4
  19. package/example/views/fruits/index-layoutsDir.hbs +0 -20
  20. package/example/views/fruits/index.hbs +0 -20
  21. package/example/views/index.hbs +0 -34
  22. package/example/views/layout/default.hbs +0 -13
  23. package/example/views/layout/fruit-details.hbs +0 -9
  24. package/example/views/layout/fruits.hbs +0 -6
  25. package/example/views/layout/html-struct.hbs +0 -21
  26. package/example/views/layout/veggie-details.hbs +0 -9
  27. package/example/views/layout/veggie.hbs +0 -6
  28. package/example/views/partials/scripts.hbs +0 -5
  29. package/example/views/partials/sub/comment.hbs +0 -1
  30. package/example/views/partials-other/other.hbs +0 -1
  31. package/example/views/replace.hbs +0 -6
  32. package/example/views/tos.txt +0 -3
  33. package/example/views/veggies/details.hbs +0 -1
  34. package/example/views/veggies.hbs +0 -17
  35. package/renovate.json +0 -13
  36. package/test/apps/async/index.js +0 -139
  37. package/test/apps/async/views/failer.hbs +0 -4
  38. package/test/apps/async/views/index.hbs +0 -16
  39. package/test/apps/async/views/layout.hbs +0 -1
  40. package/test/apps/i18n/index.js +0 -57
  41. package/test/apps/i18n/locales/en.json +0 -8
  42. package/test/apps/i18n/locales/fr.json +0 -8
  43. package/test/apps/i18n/views/index.hbs +0 -3
  44. package/test/asyncSpecs.js +0 -69
  45. package/test/cacheSpecs.js +0 -135
  46. package/test/customExtension.js +0 -35
  47. package/test/handlebarsSpecs.js +0 -92
  48. package/test/helperSpecs.js +0 -58
  49. package/test/helpers.js +0 -24
  50. package/test/i18nSpecs.js +0 -36
  51. package/test/issues/144/index.hbs +0 -1
  52. package/test/issues/153/index.hbs +0 -3
  53. package/test/issues/21/views/index.hbs +0 -1
  54. package/test/issues/21/views/layouts/default.hbs +0 -1
  55. package/test/issues/21/views/layouts/sub/child.hbs +0 -1
  56. package/test/issues/21/views/sub/relativeLayout.hbs +0 -1
  57. package/test/issues/21/views/sub/sub.hbs +0 -1
  58. package/test/issues/21/views/useLayoutInDir.hbs +0 -1
  59. package/test/issues/22/layout1.hbs +0 -1
  60. package/test/issues/22/layout2.hbs +0 -1
  61. package/test/issues/22/template.hbs +0 -1
  62. package/test/issues/23/empty.hbs +0 -0
  63. package/test/issues/23/emptyComment.hbs +0 -1
  64. package/test/issues/23/emptyPartial.hbs +0 -1
  65. package/test/issues/23/index.hbs +0 -4
  66. package/test/issues/23/layout.hbs +0 -1
  67. package/test/issues/23/partials/custom/comment-only.hbs +0 -1
  68. package/test/issues/23/partials/custom/empty.hbs +0 -0
  69. package/test/issues/23/partials/hello.hbs +0 -1
  70. package/test/issues/49/error.hbs +0 -1
  71. package/test/issues/49/front/error.hbs +0 -1
  72. package/test/issues/49/index.hbs +0 -2
  73. package/test/issues/49/layouts/default.hbs +0 -1
  74. package/test/issues/49/partial.hbs +0 -1
  75. package/test/issues/49/partials/partial-error.hbs +0 -1
  76. package/test/issues/53/default.hbs +0 -15
  77. package/test/issues/53/index.hbs +0 -7
  78. package/test/issues/53/partials/.gitkeep +0 -0
  79. package/test/issues/59/index.hbs +0 -2
  80. package/test/issues/62/basic.hbs +0 -2
  81. package/test/issues/62/block.hbs +0 -11
  82. package/test/issues/73/index.hbs +0 -5
  83. package/test/issues/73/partials/partial.hbs +0 -6
  84. package/test/issues/76/mypartial.hbs +0 -0
  85. package/test/issues/84/index.hbs +0 -1
  86. package/test/issues/84/partials/abc/def/ghi/test.hbs +0 -1
  87. package/test/issues.js +0 -490
  88. package/test/layoutSpecs.js +0 -116
  89. package/test/localTemplateOptions/data-access-template.hbs +0 -1
  90. package/test/localTemplateOptions/template.hbs +0 -1
  91. package/test/localTemplateOptions.js +0 -125
  92. package/test/multiple.js +0 -115
  93. package/test/nonExpress.js +0 -36
  94. package/test/optionsSpecs.js +0 -22
  95. package/test/resolverSpecs.js +0 -54
  96. package/test/views/beautify/expected.hbs +0 -9
  97. package/test/views/beautify/index.hbs +0 -2
  98. package/test/views/customExtension/layout.server.view.html +0 -1
  99. package/test/views/customExtension/partialsDir/partial1.server.view.html +0 -1
  100. package/test/views/customExtension/partialsDir/partial2.server.view.html +0 -1
  101. package/test/views/customExtension/partialsDir/subs/subPartial1.server.view.html +0 -1
  102. package/test/views/customExtension/partialsDir/subs/subPartial2.server.view.html +0 -1
  103. package/test/views/customExtension/template.server.view.html +0 -5
  104. package/test/views/disableLayoutDirective/aside.hbs +0 -1
  105. package/test/views/disableLayoutDirective/index.hbs +0 -2
  106. package/test/views/disableLayoutDirective/layouts/default.hbs +0 -1
  107. package/test/views/helpers/home/async.hbs +0 -6
  108. package/test/views/helpers/home/index.hbs +0 -3
  109. package/test/views/helpers/layouts/default.hbs +0 -1
  110. package/test/views/multiple/views1/collide.hbs +0 -1
  111. package/test/views/multiple/views1/error.hbs +0 -1
  112. package/test/views/multiple/views1/test1.hbs +0 -1
  113. package/test/views/multiple/views2/collide.hbs +0 -1
  114. package/test/views/multiple/views2/error.hbs +0 -1
  115. package/test/views/multiple/views2/test2.hbs +0 -1
  116. package/test/views/viewsDir/layouts/default.hbs +0 -1
  117. package/test/views/viewsDir/sub/directive.hbs +0 -2
  118. package/test/views/viewsDir/sub/lay.hbs +0 -1
@@ -1,9 +0,0 @@
1
- {{!< fruits}}
2
-
3
- <h3>NESTED LAYOUT</h3>
4
-
5
- <p>This is one of my favorite fruits!</p>
6
-
7
- <span class="fruit-details">
8
- {{{body}}}
9
- </span>
@@ -1,6 +0,0 @@
1
- {{!< html-struct}}
2
-
3
- <h2>DECLARATIVE LAYOUT</h2>
4
-
5
- <!-- Placeholder for page content. -->
6
- {{{body}}}
@@ -1,21 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>{{title}}</title>
5
- <link type="text/css" rel="stylesheet" href="/css/style.css"/>
6
- {{{block "pageStyles"}}}
7
- </head>
8
-
9
- <body>
10
-
11
- <!-- Placeholder for page content. -->
12
- {{{body}}}
13
-
14
- <!-- Partials are common snippets to be used 1 or more pages. -->
15
- {{> scripts}}
16
- {{> other}}
17
-
18
- <!-- A block is placeholder for pieces of content defined in a page. -->
19
- {{{block 'pageScripts'}}}
20
- </body>
21
- </html>
@@ -1,9 +0,0 @@
1
- {{!< veggie}}
2
-
3
- <h3>NESTED LAYOUT</h3>
4
-
5
- <p>This is one of my favorite veggies!</p>
6
-
7
- <span class="veggie-details">
8
- {{{body}}}
9
- </span>
@@ -1,6 +0,0 @@
1
- {{!< html-struct}}
2
-
3
- <h2>PROGRAMMATIC LAYOUT</h2>
4
-
5
- <!-- Placeholder for page content. -->
6
- {{{body}}}
@@ -1,5 +0,0 @@
1
- {{#if production}}
2
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
3
- {{else}}
4
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js"></script>
5
- {{/if}}
@@ -1 +0,0 @@
1
- <!-- just a comment -->
@@ -1 +0,0 @@
1
- <!-- Other partial -->
@@ -1,6 +0,0 @@
1
- {{#contentFor 'replaced-default-block'}}
2
- Non-default block content
3
- {{/contentFor}}
4
-
5
-
6
- <h1>{{title}}</h1>
@@ -1,3 +0,0 @@
1
- <h4>Terms of Service</h4>
2
-
3
- <div>Async result!</div>
@@ -1 +0,0 @@
1
- {{veggie}}
@@ -1,17 +0,0 @@
1
- {{#contentFor 'pageStyles'}}
2
- <style>
3
- li a {
4
- color: #800;
5
- }
6
- </style>
7
- {{/contentFor}}
8
-
9
- {{> sub/comment}}
10
- <h1>{{title}}</h1>
11
- <ul>
12
- {{#each veggies}}
13
- <li>
14
- <a href="/veggies/{{this.name}}">{{this.name}}</a>
15
- </li>
16
- {{/each}}
17
- </ul>
package/renovate.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
- "extends": [
4
- "local>TryGhost/renovate-config"
5
- ],
6
- "packageRules": [
7
- {
8
- "description": "Keep pnpm on 10.x while this repo supports Node 20; pnpm 11 requires Node 22.13 or newer.",
9
- "matchPackageNames": ["pnpm"],
10
- "allowedVersions": "<11"
11
- }
12
- ]
13
- }
@@ -1,139 +0,0 @@
1
- 'use strict';
2
-
3
- var express = require('express');
4
- var cookieParser = require('cookie-parser');
5
- var fs = require('fs');
6
- var path = require('path');
7
- var url = require('url');
8
-
9
- var pages = [
10
- {
11
- id: 1,
12
- title: 'Title 1',
13
- },
14
- {
15
- id: 2,
16
- title: 'Title 2',
17
- },
18
- {
19
- id: 3,
20
- title: 'Title 3',
21
- },
22
- ];
23
-
24
- var comments = [
25
- {
26
- id: 1,
27
- page: 1,
28
- subject: 'Title 1 Comment 1',
29
- auther: 'JT',
30
- },
31
- {
32
- id: 2,
33
- page: 1,
34
- subject: 'Title 1 Comment 2',
35
- auther: 'Anna',
36
- },
37
- {
38
- id: 3,
39
- page: 1,
40
- subject: 'Title 1 Comment 3',
41
- auther: 'Jane',
42
- },
43
- {
44
- id: 4,
45
- page: 1,
46
- subject: 'Title 1 Comment 4',
47
- auther: 'Bob',
48
- },
49
- {
50
- id: 5,
51
- page: 4,
52
- subject: 'This should not show!',
53
- auther: 'Jill',
54
- },
55
- ];
56
-
57
- function getRandomNumber(min, max) {
58
- return Math.random() * (max - min) + min;
59
- }
60
-
61
- function create(hbs, env) {
62
- if (env) process.env.NODE_ENV = env;
63
- var app = express();
64
- var viewsDir = path.join(__dirname, 'views');
65
-
66
- // Hook in express-hbs and tell it where known directories reside
67
- app.engine(
68
- 'hbs',
69
- hbs.express4({
70
- defaultLayout: path.join(viewsDir, 'layout.hbs'),
71
- restrictLayoutsTo: viewsDir,
72
- }),
73
- );
74
- app.set('view engine', 'hbs');
75
- app.set('views', viewsDir);
76
-
77
- app.use(cookieParser());
78
-
79
- app.get('/', function (req, res) {
80
- res.render('index', {
81
- message: 'Hello,',
82
- username: req.cookies.user,
83
- });
84
- });
85
-
86
- app.get('/fail', function (req, res) {
87
- res.render('failer');
88
- });
89
-
90
- hbs.registerAsyncHelper('user', function (username, resultcb) {
91
- setTimeout(
92
- function () {
93
- resultcb(username);
94
- },
95
- getRandomNumber(100, 900),
96
- );
97
- });
98
-
99
- hbs.registerAsyncHelper('pages', function (options, resultcb) {
100
- var self = this;
101
- setTimeout(
102
- function () {
103
- var result = [];
104
- for (var i = 0; i < pages.length; i++) {
105
- options.data.page = pages[i];
106
- result.push(options.fn.call(self, pages[i], options));
107
- }
108
- resultcb(result.join(''));
109
- },
110
- getRandomNumber(100, 900),
111
- );
112
- });
113
-
114
- hbs.registerAsyncHelper('comments', function (options, resultcb) {
115
- var self = this;
116
- setTimeout(
117
- function () {
118
- var result = [];
119
- for (var i = 0; i < comments.length; i++) {
120
- if (options.hash.page === comments[i].page) {
121
- result.push(options.fn(comments[i]));
122
- }
123
- }
124
- resultcb(result.join(''));
125
- },
126
- getRandomNumber(100, 300),
127
- );
128
- });
129
-
130
- hbs.registerAsyncHelper('failer', function (_, resultcb) {
131
- setTimeout(function () {
132
- resultcb(options.fn());
133
- }, 100);
134
- });
135
-
136
- return app;
137
- }
138
-
139
- exports.create = create;
@@ -1,4 +0,0 @@
1
- {{#contentFor "title"}}
2
- Failer
3
- {{/contentFor}}
4
- <span id="text">This should fail {{#failer}}for sure{{/failer}}.</span>
@@ -1,16 +0,0 @@
1
- {{#contentFor "title"}}
2
- {{message}} {{{user username}}}
3
- {{/contentFor}}
4
- <span id="text">This should welcome {{username}}.</span>
5
- <div class="pages">
6
- {{#pages filter="tags:test"}}
7
- <div class="page">
8
- <span class="title">{{title}}</title>
9
- <div class="top-comments">
10
- {{#comments top="3" page=id}}
11
- <span class="subject">{{subject}}</span>-<span class="auther">{{auther}}</span>
12
- {{/comments}}
13
- </div>
14
- </div>
15
- {{/pages}}
16
- </div>
@@ -1 +0,0 @@
1
- <html><title>{{{block "title"}}}</title><body>{{{body}}}</body></html>
@@ -1,57 +0,0 @@
1
- /**
2
- * This example is intended to show a cookie usage in express setup
3
- * with handlebars (hbs) template engine and also to be run
4
- * as integration test for concurrency issues.
5
- *
6
- * Please remove setTimeout(), if you intend to use it as a blueprint!
7
- *
8
- */
9
-
10
- function create(hbs, env) {
11
- 'use strict';
12
-
13
- if (env) process.env.NODE_ENV = env;
14
-
15
- var express = require('express');
16
- var cookieParser = require('cookie-parser');
17
- var app = express();
18
- var fs = require('fs');
19
- var path = require('path');
20
- var viewsDir = __dirname + '/views';
21
- var i18n = require('i18n');
22
- var url = require('url');
23
-
24
- // minimal config
25
- i18n.configure({
26
- locales: ['en', 'fr'],
27
- cookie: 'locale',
28
- directory: __dirname + '/locales',
29
- });
30
-
31
- // Hook in express-hbs and tell it where known directories reside
32
- app.engine(
33
- 'hbs',
34
- hbs.express3({
35
- i18n: i18n,
36
- restrictLayoutsTo: viewsDir,
37
- }),
38
- );
39
- app.set('view engine', 'hbs');
40
- app.set('views', viewsDir);
41
-
42
- // you'll need cookies
43
- app.use(cookieParser());
44
-
45
- // init i18n module for this loop
46
- app.use(i18n.init);
47
-
48
- app.get('/', function (req, res) {
49
- res.render('index', {
50
- array: [1, 2],
51
- });
52
- });
53
-
54
- return app;
55
- }
56
-
57
- exports.create = create;
@@ -1,8 +0,0 @@
1
- {
2
- "text to test": "text to test",
3
- "%d cat": {
4
- "one": "%d cat",
5
- "other": "%d cats"
6
- },
7
- "each": "each"
8
- }
@@ -1,8 +0,0 @@
1
- {
2
- "text to test": "Texte à tester",
3
- "%d cat": {
4
- "one": "%d chat",
5
- "other": "%d chats"
6
- },
7
- "each": "chaque"
8
- }
@@ -1,3 +0,0 @@
1
- <span id="text">{{__ "text to test"}}</span>
2
- <br>
3
- {{#each array}}<span class="{{__ "each"}}">{{__n "%d cat" "%d cats" .}}</span>{{/each}}
@@ -1,69 +0,0 @@
1
- 'use stirct';
2
-
3
- var request = require('supertest');
4
- var assert = require('assert');
5
- var hbs = require('..');
6
- var asyncApp = require('./apps/async');
7
- var resolver = require('../lib/resolver');
8
-
9
- function makeUserRequest(app, user, cb) {
10
- request(app)
11
- .get('/')
12
- .set('Cookie', 'user=' + user)
13
- .end(function (err, res) {
14
- if (err) cb(err);
15
- if (res.text.search('Hello, ' + user) <= 0) {
16
- return cb(new Error('Wrong template send for user ' + user + ': ' + res.text), user);
17
- }
18
- return cb(null, user, res.text);
19
- });
20
- }
21
-
22
- function requestAll(app, users, cb) {
23
- var status = {};
24
- for (var i = 0; i < users.length; i++) {
25
- status[users[i]] = 'Pending';
26
- makeUserRequest(app, users[i], function (err, user) {
27
- if (err) {
28
- status[user] = 'Error: ' + err.message;
29
- } else {
30
- status[user] = 'Completed';
31
- }
32
- });
33
- }
34
- var checkTimer = setInterval(function () {
35
- for (var i = 0; i < users.length; i++) {
36
- if (status[users[i]] === 'Pending') {
37
- return;
38
- }
39
- }
40
- clearInterval(checkTimer);
41
- cb(status);
42
- }, 100);
43
- }
44
-
45
- describe('async', function () {
46
- it('should render all async helpers', function (done) {
47
- var app = asyncApp.create(hbs.create(), 'production');
48
- requestAll(app, ['jt', 'anna', 'joe', 'jeff', 'jane'], function (results) {
49
- assert.equal(results.jt, 'Completed');
50
- assert.equal(results.anna, 'Completed');
51
- assert.equal(results.joe, 'Completed');
52
- assert.equal(results.jeff, 'Completed');
53
- assert.equal(results.jane, 'Completed');
54
- done();
55
- });
56
- });
57
-
58
- it('should render nested async helpers', function (done) {
59
- var app = asyncApp.create(hbs.create(), 'production');
60
- makeUserRequest(app, 'jt', function (err, user, results) {
61
- if (err) {
62
- return done(err);
63
- }
64
- assert.equal(false, resolver.hasResolvers(results));
65
- assert.equal(-1, results.search('This should not show!'));
66
- done();
67
- });
68
- });
69
- });
@@ -1,135 +0,0 @@
1
- var request = require('supertest');
2
- var path = require('path');
3
- var rewire = require('rewire');
4
- var assert = require('assert');
5
- var fs = require('fs');
6
-
7
- /**
8
- * Creates instance of example app using an injected version of express-hbs to track the number of times a
9
- * file is read. Additionally, the $NODE_ENV environment variable may be set.
10
- *
11
- * @param env
12
- * @returns {{app: hbs, readCounts: {}}}
13
- */
14
- function createApp(env) {
15
- var readCounts = {};
16
- var hbs = rewire('../lib/hbs');
17
- hbs.__set__('fs', {
18
- readFileSync: function (filename, encoding) {
19
- if (typeof readCounts[filename] === 'undefined') {
20
- readCounts[filename] = 1;
21
- } else {
22
- readCounts[filename] += 1;
23
- }
24
-
25
- return fs.readFileSync(filename, encoding);
26
- },
27
-
28
- readFile: function (filename, encoding, cb) {
29
- if (typeof readCounts[filename] === 'undefined') {
30
- readCounts[filename] = 1;
31
- } else {
32
- readCounts[filename] += 1;
33
- }
34
-
35
- fs.readFile(filename, encoding, cb);
36
- },
37
- existsSync: function (filename, encoding) {
38
- return fs.existsSync(filename, encoding);
39
- },
40
- });
41
-
42
- // used mocked hbs in example
43
- var example = require('../example/app');
44
- var app = example.create(hbs, env);
45
- return { app: app, readCounts: readCounts };
46
- }
47
-
48
- describe('express-hbs', function () {
49
- describe('cache', function () {
50
- it('should not cache layout in `development`', function (done) {
51
- var mock = createApp('development');
52
-
53
- request(mock.app)
54
- .get('/')
55
- .end(function (err) {
56
- assert.ifError(err);
57
-
58
- request(mock.app)
59
- .get('/')
60
- .expect(/DEFAULT LAYOUT/)
61
- .end(function (err) {
62
- assert.ifError(err);
63
-
64
- var filename = path.resolve(__dirname, '../example/views/layout/default.hbs');
65
- assert.equal(mock.readCounts[filename], 2);
66
- done();
67
- });
68
- });
69
- });
70
-
71
- it('should cache layout in `production` reading file once', function (done) {
72
- var mock = createApp('production');
73
-
74
- // reads layout from fs once
75
- request(mock.app)
76
- .get('/')
77
- .end(function (err) {
78
- assert.ifError(err);
79
-
80
- request(mock.app)
81
- .get('/')
82
- .expect(/DEFAULT LAYOUT/)
83
- .end(function (err, res) {
84
- assert.ifError(err);
85
-
86
- var filename = path.resolve(__dirname, '../example/views/layout/default.hbs');
87
- assert.equal(mock.readCounts[filename], 1);
88
- done();
89
- });
90
- });
91
- });
92
-
93
- it('should not cache partials in `development`', function (done) {
94
- var mock = createApp('development');
95
-
96
- request(mock.app)
97
- .get('/veggies')
98
- .expect(/just a comment/)
99
- .end(function (err) {
100
- assert.ifError(err);
101
- request(mock.app)
102
- .get('/veggies')
103
- .expect(/just a comment/)
104
- .end(function (err) {
105
- assert.ifError(err);
106
-
107
- var filename = path.resolve(__dirname, '../example/views/partials/sub/comment.hbs');
108
- assert.equal(mock.readCounts[filename], 2);
109
- done();
110
- });
111
- });
112
- });
113
-
114
- it('should cache partials in `production', function (done) {
115
- var mock = createApp('production');
116
-
117
- request(mock.app)
118
- .get('/veggies')
119
- .expect(/just a comment/)
120
- .end(function (err) {
121
- assert.ifError(err);
122
- request(mock.app)
123
- .get('/veggies')
124
- .expect(/just a comment/)
125
- .end(function (err) {
126
- assert.ifError(err);
127
-
128
- var filename = path.resolve(__dirname, '../example/views/partials/sub/comment.hbs');
129
- assert.equal(mock.readCounts[filename], 1);
130
- done();
131
- });
132
- });
133
- });
134
- });
135
- });
@@ -1,35 +0,0 @@
1
- 'use strict';
2
- var assert = require('assert');
3
- var hbs = require('..');
4
- var path = require('path');
5
- var H = require('./helpers');
6
-
7
- // MEANJS is using custom extension .server.view.html instead of .hbs
8
- // https://github.com/meanjs/mean
9
- describe('custom extension for partials view', function () {
10
- var dirname = path.join(__dirname, 'views/customExtension');
11
- var render = hbs.create().express4({
12
- extname: '.server.view.html',
13
- partialsDir: dirname + '/partialsDir',
14
- restrictLayoutsTo: dirname,
15
- });
16
-
17
- it('should allow rendering multiple partials with custom extension', function (done) {
18
- function check(err, html) {
19
- assert.ifError(err);
20
- assert.equal(
21
- '<html>' +
22
- '<subpartial>1</subpartial>' +
23
- '<partial>1</partial>' +
24
- '<subpartial>2</subpartial>' +
25
- '<partial>2</partial>' +
26
- '</html>',
27
- H.stripWs(html),
28
- );
29
- done();
30
- }
31
-
32
- var options = { cache: true, settings: { views: dirname } };
33
- render(dirname + '/template.server.view.html', options, check);
34
- });
35
- });