', async t => {
const actual = `{{ optionFoo }}`;
const expected = ` Locals attribute: undefined Locals option: optionBar optionBar
`;
- const html = await posthtml().use(plugin({locals: {optionFoo: 'optionBar'}})).process(actual).then(result => clean(result.html));
+ const html = await posthtml().use(plugin({locals: {optionFoo: 'optionBar'}, expressions: {strictMode: false}})).process(actual).then(result => clean(result.html));
t.is(html, expected);
});
@@ -171,7 +171,36 @@ test('Must work with locals provided in options but no content passed', async t
const actual = ``;
const expected = ` Locals attribute: undefined Locals option: optionBar
`;
- const html = await posthtml().use(plugin({locals: {optionFoo: 'optionBar'}})).process(actual).then(result => clean(result.html));
+ const html = await posthtml().use(plugin({locals: {optionFoo: 'optionBar'}, expressions: {strictMode: false}})).process(actual).then(result => clean(result.html));
+
+ t.is(html, expected);
+});
+
+test('Must use parser options', async t => {
+ const actual = `PHP code in parent: `;
+ const expected = `PHP code in parent: PHP code in module: `;
+
+ const posthtmlOptions = {directives: [{name: '?php', start: '<', end: '>'}]};
+
+ const html = await posthtml().use(plugin({parser: posthtmlOptions})).process(actual, posthtmlOptions).then(result => clean(result.html));
+
+ t.is(html, expected);
+});
+
+test('Must parse attribute as locals', async t => {
+ const actual = `Module content`;
+ const expected = `Module content
`;
+
+ const html = await posthtml().use(plugin({attributeAsLocals: true})).process(actual).then(result => clean(result.html));
+
+ t.is(html, expected);
+});
+
+test('Must use posthtml-expressions options', async t => {
+ const actual = ``;
+ const expected = `bar{{ ignored }}
`;
+
+ const html = await posthtml().use(plugin({expressions: {delimiters: ['%[', ']%']}})).process(actual).then(result => clean(result.html));
t.is(html, expected);
});
diff --git a/xo.config.js b/xo.config.js
index a3516af..209b984 100644
--- a/xo.config.js
+++ b/xo.config.js
@@ -1,6 +1,7 @@
module.exports = {
space: true,
rules: {
+ 'max-params': 0,
'ava/no-skip-test': 0,
'prefer-object-spread': 0,
'capitalized-comments': 0,